Forum Discussion
"What I would like to know is where to the teaser images come from?"
For that particular component, some free marker has been added to pull in an image if an image has been added to the blog teaser section when a blog author is drafting their article. If the author fails to add a custom image specific to that blog teaser/article, then it'll pull in the "generic" Li image"
Also note that some css has been added to force the blog teaser images in this component to be the same square size as the li image, for a more uniform look. I would suggest tweaking the css or simply not relying on the css but rather try to have your creative team and/or blog authors crop & create images for blog teasers that are a consistent in size & ratio so you avoid image distortion that you sometimes see on the lithosphere
<td class="image<#if thisRow == 3> last</#if>"> <#assign teaser = message.teaser /> <#assign imageLink = " " /> <#assign imgPosB = teaser?index_of("<IMG src=") /> <#if (imgPosB > 0) > <#assign teaser2 = teaser?substring(imgPosB) /> <#assign imgPosE = teaser2?index_of("/>") /> <#if (imgPosE >0) > <#assign imageLink = teaser2?substring(0, imgPosE) + " height=110px width=110px /> " /> <#assign teaser = teaser?substring(0, imgPosB) + teaser2?substring(imgPosE+2) /> </#if> </#if> <div style="width: 110px; height: 110px; background-image: url('/html/assets/blogfeedimgsquare-blue.png'); border-radius: 2px;"> ${imageLink} </div> </td>
"I would also like to know where to get the tiny thumbnails for the author are found. Are they standard or custom?"
They're standard in the sense that the particular freemaker code here is reference the message size version of the avatar but relying on specifically written css for this component to shrink the image down.
<td class="created<#if thisRow == 3> last</#if>">
<div id="date"><#if (useFriendlyDate) >${message.post_time.@view_friendly_date}<#else>${message.post_time.@view_date?date("MM-dd-yyyy")}</#if></div>
<#assign avatar = rest(message.author.@href + "/profiles/avatar/size/message").image>
<div id="authors"><a href="${message.author.@view_href}">${message.author.login}</a> <a href="${message.author.@view_href}"><img src="${avatar.url}" title="${message.author.login}" /></a></div>
</td
Hi
We're trying to do almost the same... but i was wondering if there is an rest api method to retreive images from the blog teaser. There is an api call for the images contained in a blog message (example: http://community.lithium.com/restapi/vc/messages/id/128039/images ), but i can't found the teaser's images.
In the example you provide, we need to manually parse the teaser string, which is quite tedious and having it in a rest call would simplify the customisation on a blog page...
regards
JC
- PaoloT11 years agoLithium Alumni (Retired)
Hi jc758
The images are normally included as a part of the teaser body. Therefore it's not possible to expose a rest call, simply because the teaser can really be anything - it's a text field that the user can populate with arbitrary HTML markup and it's not safe to assume that a teaser image will always be present in your code.
A potential improvement would be to include the image parsing logic in a Macro - so that you can define it once in the Endpoints section in Studio and maintain it in one place, then simply use the macro on the teaser content in your components which would greatly clean up your logic.
Hope this helps,
- jc75811 years agoAdvisor
Hi Paolo
thanx for the answer.
Well, from my point of view (i'm not into the product team :smileyhappy:) i don't see the difference between the Teaser html field and the Body html field...
the Body is also a text field that the user can populate with arbitrary HTML...
As it seems to be the same, adding a rest call for images of that field or include the images contained in the teaser in message/image method doesn't seem to be impossible... (as http://community.lithium.com/restapi/vc/messages/id/128039/images).
Well i'll create a macro as well, many thanx.
JC
- PaoloT11 years agoLithium Alumni (Retired)
Hi jc758
thanks for sharing your point of view. I think it would be very beneficial to post an idea so that our product managers will have a chance to review your feedback.
In the meantime, let us know if you managed to progress with the macro.
Kind Regards,
Related Content
- 5 years ago
- 13 years agoInactive User