Forum
How to display image thumbnails in blog
Hi - I am creating image thumbnails for my blog author but I'm not sure how to display them. This is the command I'm using to display the actual image:
<perch:if exists="author_image">
<img src="<perch:blog id="author_image" />" width="150" height="auto" alt="<perch:blog id="authorGivenName" /> <perch:blog id="authorFamilyName" />">
</perch:if>
The thumbnail has been generated but do I just append "thumb@2x" to the URL or is there another way?
You'll need to use
type="image"
at the very least, plus whatever image and crop options you use in the master template.No that doesn't make any difference. This template is used to display the image not accept it.
The image that is served is still 3000px wide.
What does the tag in your master template look like?
<perch:if exists="author_image"> <img src="<perch:blog id="author_image" type="image" label="Image" width="240" height="240" crop="true" density="2" order="5" />" width="120" height="120" alt="<perch:blog id="authorGivenName" type="text" label="Given name" order="1" /> <perch:blog id="authorFamilyName" type="text" label="Given name" order="2" />" /> </perch:if>
Ok, so when you want to reuse the image, you'll need at least:
No that doesn't make any difference - the image served is still 3000px wide which is slowing the website down. I'm fairly sure I need to pull in the image thumbnail. If there isn't a perch:blog command that will enable me to do this I will have to try appending to the URL.
Please show me both the templates you're using.
This is the template to display the author image for a blog post in a list:
This is the template used to enter the image:
Ok, so display the image you're doing this:
but it's been uploaded like this:
The size and crop options don't match. Also there's no
auto
option for height - just leave that attribute out.To fix it, in your master template, add this:
and in your display template, use this:
Make sure you re-save the content after changing the template.