Title: Get Cropped Thumbnail
Last modified: August 21, 2016

---

# Get Cropped Thumbnail

 *  [ajberasategui](https://wordpress.org/support/users/ajberasategui/)
 * (@ajberasategui)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/get-cropped-thumbnail/)
 * Hi!
 * I’m writing a plugin for WordPress. I need to retrieve cropped version of post
   thumbnail but I can’t.
 * Here’s what I’m doing:
 * I open the image in the builtin image editor, I crop it obtaining a 203 x 300px
   version. I crop it and save it (only thumbnail).
 * Then in my plugin I’m trying to obtain it with:
    `get_the_post_thumbnail( $post-
   >ID, 'thumbnail' );` which gives me a 80 x 120px version (instead of 203 x 300)!
 * I’ve also tried the following way:
 *     ```
       <?php
       $image = wp_get_attachment_image_src( $attachId, 'thumbnail' );
       ?>
       <img src="<?php echo $image[0]; ?>" alt="<?php echo $imgAlt; ?>" />
       ```
   
 * and I’m obtaining a 91x120px version!
 * Any help will be very much appreciated!
 * Regards
    Agus

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

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/get-cropped-thumbnail/#post-4083190)
 * I too find image management baffling, but I believe using [add_image_size()](http://codex.wordpress.org/Function_Reference/add_image_size)
   will help you get the desired results.
 *  Thread Starter [ajberasategui](https://wordpress.org/support/users/ajberasategui/)
 * (@ajberasategui)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/get-cropped-thumbnail/#post-4083215)
 * Hi,
 * [@bcworkz](https://wordpress.org/support/users/bcworkz/), thank you for your 
   answer, but that solution is not good for me because the image size is not always
   the same. I’m using the WordPress image editor as I need different ratios (and
   sizes) for different images.
 * Anybody else?
 * Regards,
    Agus
 *  [Tekguild](https://wordpress.org/support/users/kcrusher/)
 * (@kcrusher)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/get-cropped-thumbnail/#post-4083228)
 * I believe your Settings>Media dictates the thumbnail size – the cropping you’re
   doing is then resized based on the thumbnail settings.
 * Try one of these instead:
 * <?php echo wp_get_attachment_img($image->ID, ‘medium’); ?>
    <?php echo wp_get_attachment_img(
   $image->ID, ‘full’); ?>
 *  Thread Starter [ajberasategui](https://wordpress.org/support/users/ajberasategui/)
 * (@ajberasategui)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/get-cropped-thumbnail/#post-4083236)
 * Hi,
 * [@kcrusher](https://wordpress.org/support/users/kcrusher/), thank you for your
   answer. No luck with you recommendations.
 * What I’ve found is that the thumbnail is getting the desired ratio but for some
   reason WordPress automatically makes it smaller. In my media settings I’ve set
   the thumbnail size bigger than my example size (203,300) but WordPress keeps 
   resizing it to 80×120 (which has about the same aspect ratio but different size).
 * So, the problem is not in getting the image but in the way saves it after cropping
   it.
 * All you help is very appreciated and further help will be as well.
 * Regards,
    Agus

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

The topic ‘Get Cropped Thumbnail’ is closed to new replies.

## Tags

 * [crop](https://wordpress.org/support/topic-tag/crop/)
 * [cropped](https://wordpress.org/support/topic-tag/cropped/)
 * [image](https://wordpress.org/support/topic-tag/image/)
 * [thumbnail](https://wordpress.org/support/topic-tag/thumbnail/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 4 replies
 * 3 participants
 * Last reply from: [ajberasategui](https://wordpress.org/support/users/ajberasategui/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/get-cropped-thumbnail/#post-4083236)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
