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)
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.