I use WordPress’s NextGen Gallery plugin frequently on the websites I design. One of the issues that I have run into is the fact that, by default, images are cropped in the center to create the thumbnails for the gallery. However, I often want to have the thumbnails cropped from the top, and here is the way I have used to do this.
First, under the Plugin section in the admin panel sidebar, click Editor, select the NextGen Gallery plugin, and open the nextgen-gallery/admin/functions.php file.
Find this line of code:
// get optimal y startpos $ypos = ($thumb->currentDimensions['height'] - $ngg->options['thumbheight']) / 2; $thumb->crop(0, $ypos, $ngg->options['thumbwidth'],$ngg->options['thumbheight']);
And change it to this:
// get optimal y startpos $ypos = ($thumb->currentDimensions['height'] - $ngg->options['thumbheight']) / 2; $thumb->crop(0, null, $ngg->options['thumbwidth'],$ngg->options['thumbheight']);
Now, save the file. Make sure you re-generate the thumbnails by going to Manage Gallery, selecting the gallery you want to edit, selecting all of the images that you want to create new thumbnails for, and then (under Bulk Actions) select Create New Thumbnails and finally, click Apply. This will generate new thumbnails images that are cropped from the top.
Let me know if you have any questions or run into any issues with this. For an in-depth explanation of what exactly you are changing, you can read this excellent post – http://www.comprepairgurus.com/force-nextgen-gallery-to-crop-thumbnails-from-the-top-of-the-image/.
