Media Library URLs

Tony Brown asked on September 30, 2014 07:01

Hello,

I've searched the questions and documentation but can't find this answer. In going through performance testing for our current site, we are wanting to leverage thumbnail images for our listing pages. We have created the images and their corresponding thumbnails in the media library.

We are leveraging multiple document types with media selection form controls to grab these images. We'd love to grab the permanent links as to do something within the transformation as follows:

style="background-image: url('<%# Eval("MarketImage", "{0}.jpg?preview=1") %>');"

However, this would work if the end URL is the permanent link (as displayed in the media library), as the thumbnail is just appending the parameter. What we are finding out is our URLs, from the Eval() statement, have the dimension and extension parameters as well which is causing the issue. It's not allowing us to append the preview parameter to grab the thumbnail (which is significantly smaller in size and hence the performance issue):

/getmedia/Guid/testimage.jpg?width=1074&height=671&ext=.jpg

We have permanent URLs turned on and in looking at the documentation this only happens when the image is resized. The confusion is that we haven't resized it. We uploaded it, uploaded the thumbnail and then attached the media file to the document type through the media form.

One thing to note is that we are using this media form field as is for the featured image of a page. The goal would be to reuse this same field and, within the transformation, grab the thumbnail of that same image for its parent page. There are multiple other fields on this document type being reused as well and would like to avoid changing.

Is there something we're missing to ensure the link inserted from the media form selector is easily manipulated to get the thumbnail? Is there an easier way to get the thumbnail image from the URL mentioned above?

Any help would be appreciated!

Thanks,

Tony

Recent Answers


Juraj Ondrus answered on December 8, 2014 09:38

Hi,

you can use the URL with the width and height parameters as well. The preview parameter has the precedence, so even having in the URL this:

?width=260&height=184&preview=1

It will load and display the thumbnail image.

Best regards,
Juraj Ondrus

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.