Skip Navigation

[Resolved] Display custom size thumbnail images from wordpress gallery

This support ticket is created 6 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 1 reply, has 2 voices.

Last updated by Beda 6 years, 11 months ago.

Assisted by: Beda.

Author
Posts
#526260

I am trying to: Reference and use custom WP thumbnail sizes in an image gallery

I visited this URL: https://toolset.com/forums/topic/displaying-images-from-media-query/

I expected to see: An argument for specifying which custom image thumbnail to pick - i.e 'thumbnail' gets .../image-150x150.jpg | 'smthumbnail' gets .../image-50x50.jpg etc.

Instead, I got: No explanation of how to specify exactly which thumbnail is used.

I know there is an easier way to bring thumbnails into galleries using repeating custom fields. However, this client has already armed all posts with WP Galleries each of them containing many images. We can reference them, and populate a thumb gallery, using the code in the view loop:

<img src="[wpv-bloginfo show='url']/wp-content/uploads/[wpv-post-field name='_wp_attached_file']" />

However, we can't specify which thumbnail size is used, and that is a problem on two counts:
1. it loads the full size image, even though the space for it is only 100x100
2. We can't match the image crop to the one it is referencing, this gallery being a navigation for the main image picture.

We tried using this code:

<img src="[wpv-bloginfo show='url']/wp-content/uploads/[wpv-post-field name='_wp_attached_file' size='project-thumb-100']" />

However, it didn't work and merely brought in the full image again.

Can you tell me what the code should be so we get the right image thumbnail from the image gallery images.

Thank you
Tim

PS - you can see an example of what we're trying to work with in the thumbnails alongside the main image on this page: hidden link
(pw: olympian17)

#526447

Usually, you will display Featured Images with the proper ShortCode for it:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-featured-image

This features also the Thumbnail size.

Now, for your situation something like this might help:

<img src="[wpv-bloginfo show='url']/wp-content/uploads/[wpv-post-title]-544x336.jpg">

This would be on a View querying Media directly.

Now if you call a Post Field that is of Image Type, created with Types, you might use this:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image

Those are the possibilities of Toolset.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.