Title: Get thumbnails in custom fields?
Last modified: August 19, 2016

---

# Get thumbnails in custom fields?

 *  [deeltje](https://wordpress.org/support/users/deeltje/)
 * (@deeltje)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/get-thumbnails-in-custom-fields/)
 *     ```
       <?php
       $leeg = 'http://www.url.ext/images/noimage.png';
       $var = get_nkm_imageurl('customfoto');
       if ($var == '')
       {
       echo $leeg;
       } else {
       echo $var;
       } ?>
       ```
   
 * I’m using the code above to display the .jpg / .gif etc. pictures that are uploaded
   via a custom_field. I’m using Thickbox to display these images in full resolution(
   fixed on the browsers resolution).
 * Now instead of linking to the original image that is uploaded, I want to link
   to the thumbnail that is created, for example:
 * – image.jpg (original image uploaded and linked)
    – image-150×150.jpg (Thumbnail
   created by WordPress that I want to link to after the image is uploaded)
 * I actually have no idea at all on how to handle this… could anyone here give 
   me some help? Or direct me in the good direction 🙂
 * The best solution would be to link to some ‘vars’ that give the following output:
 * – small_thumbnail
    – medium_thumbnail – big_thumbnail
 * I know these Thumbnails are standard in WordPress and can be configured as such.

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

 *  [doc4](https://wordpress.org/support/users/doc4/)
 * (@doc4)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/get-thumbnails-in-custom-fields/#post-1155450)
 * deeltje,
 * You might try taking a look at our article on WordPress thumbnails. It makes 
   full use of custom fields and with a minor alteration of the core to ease usage
   with custom fields.
 * WORDPRESS: PROVIDE A BETTER NAMING CONVENTION FOR THUMBNAILS:
    [http://www.doc4design.com/articles/wordpress-better-naming-of-thumbnails/](http://www.doc4design.com/articles/wordpress-better-naming-of-thumbnails/)
 * [http://www.doc4design.com](http://www.doc4design.com)
 *  Thread Starter [deeltje](https://wordpress.org/support/users/deeltje/)
 * (@deeltje)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/get-thumbnails-in-custom-fields/#post-1155493)
 * Doc4; Thats really great, the only thing is;
    What thumbnail are you talking 
   about here, because WP has 3 thumbnails created.
 * – small
    – medium – big
 * How do I know which thumbnail is gonna turn up with your code?
 * With your current code, it looks like you are taking the variable that is used
   to generate 3 different thumbnails and replacing it with a locked-var. Doesn’t
   this create an overwrite/same_file problem?
 * isn’t it possible to use something like the link below:
 * [http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src](http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src)
 *  [doc4](https://wordpress.org/support/users/doc4/)
 * (@doc4)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/get-thumbnails-in-custom-fields/#post-1155528)
 * deeltje,
 * I should have mentioned this works best with a single thumbnail. Re-size it only
   once and change the other sizes to “0” then simply re-size with CSS any other
   thumbnail sizes you require. No need to junk up the Uploads folder.
 * [http://www.doc4design.com](http://www.doc4design.com)
 *  Thread Starter [deeltje](https://wordpress.org/support/users/deeltje/)
 * (@deeltje)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/get-thumbnails-in-custom-fields/#post-1155568)
 * Doc4,
 * Is there anyway to get this to work without alternating the base-code of WP? 
   And with 3 different thumbnails?

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

The topic ‘Get thumbnails in custom fields?’ is closed to new replies.

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 4 replies
 * 2 participants
 * Last reply from: [deeltje](https://wordpress.org/support/users/deeltje/)
 * Last activity: [16 years, 9 months ago](https://wordpress.org/support/topic/get-thumbnails-in-custom-fields/#post-1155568)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
