Close

Account

Documentation

Forum

Menu

Custom Image Crop

  • Post count: 2
    pyramedia
    November 14, 2017 at 11:11 am #25430

    Hi
    im having bit of difficulty in cropping image it seems that you guys are using array for custom image sizes, since all images on our website are 1:1 ratio therefore i want the theme to crop all images not from center but something like this for all image sizes

    add_image_size( ‘wordpress-thumbnail’, 200, 200, array( ‘center’, ‘top’ ) );

    Post count: 6417
    Adek
    November 15, 2017 at 1:38 am #25443

    Hi pyramedia,

    It seems you understand how image ratio works on WordPress. In this case, please find out this file /jnews/class/Image/Image.php then find function setup_image_size and add_image_size. You may edit those function as your own need. Also, we will recommend you to use JNews Child Theme. After you have done with the changes, you may need to regenerate all of your images. You can use Regenerate Thumbnails plugin.

    Let us know if you have further question.

    Thank you

    Post count: 2
    pyramedia
    November 15, 2017 at 6:22 am #25454

    can you make these crop from center top

    $this->prefix . ‘360×180’ => array(‘width’ => 360, ‘height’ => 180, ‘crop’ => true , ‘dimension’ => 500),
    $this->prefix . ‘750×375’ => array(‘width’ => 750, ‘height’ => 375, ‘crop’ => true , ‘dimension’ => 500),
    $this->prefix . ‘1140×570’ => array(‘width’ => 1140, ‘height’ => 570, ‘crop’ => true , ‘dimension’ => 500),

    // dimension : 0.715
    $this->prefix . ‘120×86’ => array(‘width’ => 120, ‘height’ => 86, ‘crop’ => true , ‘dimension’ => 715),
    $this->prefix . ‘350×250’ => array(‘width’ => 350, ‘height’ => 250, ‘crop’ => true , ‘dimension’ => 715),
    $this->prefix . ‘750×536’ => array(‘width’ => 750, ‘height’ => 536, ‘crop’ => true , ‘dimension’ => 715),
    $this->prefix . ‘1140×815’ => array(‘width’ => 1140, ‘height’ => 815, ‘crop’ => true , ‘dimension’ => 715),

    // dimension
    $this->prefix . ‘360×504’ => array(‘width’ => 360, ‘height’ => 504, ‘crop’ => true , ‘dimension’ => 1400),

    // dimension 1
    $this->prefix . ’75×75′ => array(‘width’ => 75, ‘height’ => 75, ‘crop’ => true , ‘dimension’ => 1000),

    // featured post
    $this->prefix . ‘featured-750’ => array(‘width’ => 750, ‘height’ => 0, ‘crop’ => true , ‘dimension’ => 1000),
    $this->prefix . ‘featured-1140’ => array(‘width’ => 1140, ‘height’ => 0, ‘crop’ => true , ‘dimension’ => 1000),

    Post count: 1933
    Rai
    November 16, 2017 at 12:57 am #25475

    Hi,

    Please change setup_image_size function code to this:

    After that you need to regenerate thumbnails, to do that make sure plugin “Regenerate Thumbnails” is installed & activated. Navigate to “Tools > Regen. Thumbnails” and click the “Regenerate All Thumbnails”.

    Thank you

    Post count: 2
    pyramedia
    November 19, 2017 at 6:46 am #25647

    well thats great i would need another help. i want to include a custom image size here and show it on single post display page instead of featured image. can you help

    Post count: 6417
    Adek
    November 20, 2017 at 2:00 am #25674

    Hi pyramedia,

    Can you please tell us more detail what kind of custom image size that you want to have? So we can easily to help you.

    Thank you

You must be logged in to reply to this topic.