Title: Thumbnail size &#8211; width priority
Last modified: August 18, 2016

---

# Thumbnail size – width priority

 *  Resolved [alains](https://wordpress.org/support/users/alains/)
 * (@alains)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/thumbnail-size-width-priority/)
 * Yes, I’ve seen related posts and none of them resolved my problem.
 * Most related posts that I’ve seen and tried:
    [http://wordpress.org/support/topic/53640?replies=57](http://wordpress.org/support/topic/53640?replies=57)
   [http://wordpress.org/support/topic/60927?replies=9](http://wordpress.org/support/topic/60927?replies=9)
   [http://wordpress.org/support/topic/74794?replies=5](http://wordpress.org/support/topic/74794?replies=5)
   [http://wordpress.org/support/topic/77379?replies=4](http://wordpress.org/support/topic/77379?replies=4)
   [http://wordpress.org/support/topic/54180?replies=11](http://wordpress.org/support/topic/54180?replies=11)
   [http://wordpress.org/support/topic/91566?replies=2](http://wordpress.org/support/topic/91566?replies=2)
 * To hell with ratio. I just want that thumb will be “let’s say” 120px in width.
   It doesn’t matter if height is 1000px. So an image 300×4000 should resize to 
   120x??? in proportion.
 * Every try with solutions in mentioned posts were semi or fully useless.
 * Is it for real or for “…” that no one in the WP universe has a solution?

Viewing 1 replies (of 1 total)

 *  Thread Starter [alains](https://wordpress.org/support/users/alains/)
 * (@alains)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/thumbnail-size-width-priority/#post-476626)
 * Ok WP folks…I’ve figured it out after many tests.
 * This solution is for everyone that wants all thumbs be max. xxx width… no matter
   if image is 2:10 in proportion.
 * Replace my 120 value with width of your choice.
 * Her we go:
 * **In inline-uploading.php comment out this:**
 * `
    if ( $imagedata['width'] * $imagedata['height'] < 4 * 1024 * 1024 ) { if (
   $imagedata['width'] > 120 && $imagedata['width'] >=
 * $imagedata['height'] * 0.2 )
    $thumb = wp_create_thumbnail($file, 120); elseif(
   $imagedata['height'] > 150 ) $thumb = wp_create_thumbnail($file, 150);
 *  if ( @file_exists($thumb) ) {
    $newdata = $imagedata; $newdata['thumb'] = basename(
   $thumb); update_post_meta($id, '_wp_attachment_metadata', $newdata,
 * $imagedata);
    } else { $error = $thumb; } }
 * **and replace it with:**
 * if ( $imagedata['width'] * $imagedata['height'] < 4 * 1024 * 1024 )
    { if ( $
   imagedata['width'] > 120 ) $thumb = wp_create_thumbnail($file, 120);
 *  if ( @file_exists($thumb) )
    { $newdata = $imagedata; $newdata['thumb'] = basename(
   $thumb); update_post_meta($id, '_wp_attachment_metadata',
 * $newdata, $imagedata);
    } else { $error = $thumb; } }
 * **then go to admin-functions.php and comment out this portion of code:**
 * if ($image_attr[0] > $image_attr[1]) {
    $image_width = $image_attr[0]; $image_height
   = $image_attr[1]; $image_new_width = $max_side;
 *  $image_ratio = $image_width / $image_new_width;
    $image_new_height = $image_height/
   $image_ratio; //width is > height } else { $image_width = $image_attr[0]; $image_height
   = $image_attr[1]; $image_new_height = $max_side;
 *  $image_ratio = $image_height / $image_new_height;
    $image_new_width = $image_width/
   $image_ratio; //height > width }
 * **add this instead:**
 * $image_width = $image_attr[0];
    $image_height = $image_attr[1]; $image_new_width
   = $max_side;
 *  $image_ratio = $image_width / $image_new_width;
    $image_new_height = $image_height/
   $image_ratio;
 * That’s it. Now all thumbnails will follow the 120 max width rule. Just replace
   120 with width of your choice.
 * I think that this post can be marked as resolved 🙂
 * It’s really interesting that finding a solution to this problem was really a 
   pain in the ass. I was able to find solutions and help on this forum to more 
   obscure problems.
 * Thmubs up for integrating thumbnail handling in next release of WP – the greatest
   tool that web ever seen.

Viewing 1 replies (of 1 total)

The topic ‘Thumbnail size – width priority’ is closed to new replies.

## Tags

 * [resize](https://wordpress.org/support/topic-tag/resize/)
 * [thumbnail](https://wordpress.org/support/topic-tag/thumbnail/)
 * [thumbnails](https://wordpress.org/support/topic-tag/thumbnails/)
 * [width](https://wordpress.org/support/topic-tag/width/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [alains](https://wordpress.org/support/users/alains/)
 * Last activity: [19 years, 6 months ago](https://wordpress.org/support/topic/thumbnail-size-width-priority/#post-476626)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
