• I was very frustrated by the fact that when i inserted a featured image into my post from a nextgen gallery it would not crop the image from the center.

    It would only center based on the Y_pos and not on the X_pos.

    First of all I am not a developer so it took me a while to figure it out but I think I found a solution.

    What I did was change in lib/image.php lines 164 and 165.
    from:

    164 $ypos = ($thumb->currentDimensions['height'] - $height) / 2;
    165 $thumb->crop(0, $ypos, $width, $height);

    to:

    164 $ypos = ($thumb->currentDimensions['height'] - $height) / 2;
    165 $xpos = ($thumb->currentDimensions['width'] - $width) / 2;
    166 $thumb->crop($xpos, $ypos, $width, $height);

    Now I am wondering:
    – if I am the only who is in need of this solution?
    – if someone can tell me why they originally choose to only center based on Y_pos?
    – if this could be added/changed by the developers of the plugin so I wont have to change it with every new release from nextgen plugin.
    – If this wont be added to a future release, if there is a way to add my changes on a correct way (The way you use functions.php to overwrite WP functions for example)

    So I do hope I can get some feedback and also I do hope someone else can use my ‘little’ change….

    https://www.ads-software.com/extend/plugins/nextgen-gallery/

  • The topic ‘centered crop by NextGen not working’ is closed to new replies.