Title: [Plugin: NextGEN Gallery] Create New Thumbnails
Last modified: August 20, 2016

---

# [Plugin: NextGEN Gallery] Create New Thumbnails

 *  [lenzenmi](https://wordpress.org/support/users/lenzenmi/)
 * (@lenzenmi)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-create-new-thumbnails/)
 * When you select Set Fix Dimension while generating new thumbnails, the cropping
   is looking pretty good these days.
 * The only issue I have, is with vertical photos. In general, if I’ve taken a photo
   vertically of a person, the face tends to be near the top of the photo. The cropping
   function by default crop the center portion of a vertically aligned photo, giving
   me thumbnail of bellies and breasts. It would be nice if the cropping began at
   the top of the photo, or even better – applied some form of face recognition.
 * Would it be possible to open up a vertical crop position option for future releases
   where a crop top,center,bottom option could be selected?
 * Again, only needed for the set fix dimensions option.
 * [http://wordpress.org/extend/plugins/nextgen-gallery/](http://wordpress.org/extend/plugins/nextgen-gallery/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [lenzenmi](https://wordpress.org/support/users/lenzenmi/)
 * (@lenzenmi)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-create-new-thumbnails/#post-2345454)
 * I added the easy top, middle, bottom functionality with these patches. Please
   feel free to include them in future releases, or modify them to your hearts desire.
 *     ```
       diff -ur orig/nextgen-gallery/admin/functions.php nextgen-gallery/admin/functions.php
       --- orig/nextgen-gallery/admin/functions.php	2011-08-15 13:37:31.000000000 -0600
       +++ nextgen-gallery/admin/functions.php	2011-10-16 11:03:54.643408787 -0600
       @@ -286,7 +286,23 @@
        					// first resize to the wanted width
   
        					$thumb->resize($ngg->options['thumbwidth'], 0);
   
        					// get optimal y startpos
   
       -					$ypos = ($thumb->currentDimensions['height'] - $ngg->options['thumbheight']) / 2;
   
       +					//$ypos = get_Ypos($ngg->options['vcropalign']);
   
       +                                        switch ($ngg->options['vcropalign']) {
   
       +                                            case "middle":
   
       +                                                $ypos = ($thumb->currentDimensions['height'] - $ngg->options['thumbheight']) / 2;
   
       +                                                break;
   
       +
   
       +                                            case "top":
   
       +                                                $ypos = 0;
   
       +                                                break;
   
       +
   
       +                                            case "bottom":
   
       +                                                $ypos = ($thumb->currentDimensions['height'] - $ngg->options['thumbheight']);
   
       +                                                break;
   
       +
   
       +                                            default: //middle
   
       +                                                $ypos = ($thumb->currentDimensions['height'] - $ngg->options['thumbheight']) / 2;
   
       +                                        }
   
        					$thumb->crop(0, $ypos, $ngg->options['thumbwidth'],$ngg->options['thumbheight']);	
   
        				} else {
   
        					// first resize to the wanted height
   
       @@ -1457,7 +1473,7 @@
   
        	        return $message; 
   
        	}
   
       -
   
       +     
   
        } // END class nggAdmin
   
        /**
   
       diff -ur orig/nextgen-gallery/admin/manage-galleries.php nextgen-gallery/admin/manage-galleries.php
       --- orig/nextgen-gallery/admin/manage-galleries.php	2011-08-15 13:37:31.000000000 -0600
       +++ nextgen-gallery/admin/manage-galleries.php	2011-10-16 09:47:29.883202949 -0600
       @@ -342,6 +342,16 @@
        				<td><input type="checkbox" name="thumbfix" value="1" <?php checked('1', $ngg->options['thumbfix']); ?> />
   
        				<br /><small><?php _e('Ignore the aspect ratio, no portrait thumbnails','nggallery') ?></small></td>
   
        			</tr>
   
       +                        <tr valign="top">
   
       +                                <th align="left">Vertical Crop Alignment</th>
   
       +                                <td><select name="vcropalign">
   
       +                                    <option value="top"<?php selected( $ngg->options['vcropalign'], 'top' ); ?>>Top</option>
   
       +                                    <option value="middle"<?php selected( $ngg->options['vcropalign'], 'middle' ); ?>>Middle</option>
   
       +                                    <option value="bottom"<?php selected( $ngg->options['vcropalign'], 'bottom' ); ?>>Bottom</option>
   
       +                                </select>
   
       +                                <br /><small>Only matters if Set Fix Dimension is selected</small>
   
       +                               </td>
   
       +                        </tr>
   
        		  	<tr align="right">
   
        		    	<td colspan="2" class="submit">
   
        		    		<input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php _e('OK', 'nggallery');?>" />
   
       diff -ur orig/nextgen-gallery/admin/manage-images.php nextgen-gallery/admin/manage-images.php
       --- orig/nextgen-gallery/admin/manage-images.php	2011-08-15 13:37:31.000000000 -0600
       +++ nextgen-gallery/admin/manage-images.php	2011-10-16 09:47:29.873202952 -0600
       @@ -622,6 +622,16 @@
        				<td><input type="checkbox" name="thumbfix" value="1" <?php checked('1', $ngg->options['thumbfix']); ?> />
   
        				<br /><small><?php _e('Ignore the aspect ratio, no portrait thumbnails','nggallery') ?></small></td>
   
        			</tr>
   
       +                        <tr valign="top">
   
       +                                <th align="left">Vertical Crop Alignment</th>
   
       +                                <td><select name="vcropalign">
   
       +                                    <option value="top"<?php selected( $ngg->options['vcropalign'], 'top' ); ?>>Top</option>
   
       +                                    <option value="middle"<?php selected( $ngg->options['vcropalign'], 'middle' ); ?>>Middle</option>
   
       +                                    <option value="bottom"<?php selected( $ngg->options['vcropalign'], 'bottom' ); ?>>Bottom</option>
   
       +                                </select>
   
       +                                <br /><small>Only matters if Set Fix Dimension is selected</small>
   
       +                               </td>
   
       +                        </tr>
   
        		  	<tr align="right">
   
        		    	<td colspan="2" class="submit">
   
        		    		<input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php _e('OK', 'nggallery');?>" />
   
       diff -ur orig/nextgen-gallery/admin/manage.php nextgen-gallery/admin/manage.php
       --- orig/nextgen-gallery/admin/manage.php	2011-08-15 13:37:31.000000000 -0600
       +++ nextgen-gallery/admin/manage.php	2011-10-16 09:47:29.863202949 -0600
       @@ -215,6 +215,7 @@
        			$ngg->options['thumbwidth']  = (int)  $_POST['thumbwidth'];
   
        			$ngg->options['thumbheight'] = (int)  $_POST['thumbheight'];
   
        			$ngg->options['thumbfix']    = (bool) $_POST['thumbfix']; 
   
       +                        $ngg->options['vcropalign']    = (string) $_POST['vcropalign'];
   
        			// What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback
   
        			update_option('ngg_options', $ngg->options);
       ```
   
 *  Thread Starter [lenzenmi](https://wordpress.org/support/users/lenzenmi/)
 * (@lenzenmi)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-create-new-thumbnails/#post-2345459)
 * Missed saving the option for manage-images. This patch will fix it after the 
   above patch has been applied
 *     ```
       # This patch file was generated by NetBeans IDE
       # It uses platform neutral UTF-8 encoding and \n newlines.
       --- 1.1
       +++ 1.2
       @@ -215,6 +215,7 @@
        			$ngg->options['thumbwidth']  = (int)  $_POST['thumbwidth'];
        			$ngg->options['thumbheight'] = (int)  $_POST['thumbheight'];
        			$ngg->options['thumbfix']    = (bool) $_POST['thumbfix'];
       +                        $ngg->options['vcropalign']    = (string) $_POST['vcropalign'];
       \ No newline at end of file
        			// What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback
        			update_option('ngg_options', $ngg->options);
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: NextGEN Gallery] Create New Thumbnails’ is closed to new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

 * 2 replies
 * 1 participant
 * Last reply from: [lenzenmi](https://wordpress.org/support/users/lenzenmi/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-create-new-thumbnails/#post-2345459)
 * Status: not resolved