Image resize
Hello,
Is there a way to change/configure what the available options are for resizing an image during upload (to an album)? Attached is a screenshot of the available sizes -- however, none of these sizes work for me -- I would like to configure my own. (I want my images to be 150 pixels wide for instance). How would I go about doing this?
Thanks!
This article is great for setting up custom thumbnail sizes. I've used it a number of times.
Hi Jonathan,
Yes thanks -- I did come across that article as well to follow. I was 'hoping' that there would be something for easier/simpler to do though -- as the 'default' LOV is populated by values (pixel width values) -- I was hoping this LOV's values were stored simply (in a config file or something) so that they could be easily modified and thus eliminate the need to add in customized code handling...
You could enable Allow dynamic resizing of images in Settings >> Advanced >> Libraries >> Images (image attached)
this allows you to page image.png?size=150 and dynamicly resizes the image to a width of 150px
Hmm, yes that could work; however it's not ideal (I'm currently in the process of importing in a large amount of images (200+) into my library/album -- manually resizing them would be a pain :\
It's manually re-sizing it Dynamically. So wherever you are using the image you add the Query string to it and it is re-sized at runtime. <img src="/images/image.png?size=150" /> You would import your images as normal then use whatever size you need wherever.
Hmm, is that possible when using an 'ImageAssetsField' element? Currently in my template I have: <sf:ImageAssetsField runat="server" DataFieldName="Image" IsThumbnail="False" />
No, not directly.
Thanks for the brainstorming session -- got it to work:
Front end code:
<img src="<%# GetImageUrl(Container.DataItem) %>" alt="" />
Back end code:
protected string GetImageUrl(object item)
var retval = string.Empty;
// ensure correct item type
var product = item as DynamicContent;
if (product == null) return retval;
// retrieve the Screenshot value and extract the first (and only) item
var contentLinks = (ContentLink[])product.GetValue("Image");
ContentLink imageContentLink = contentLinks.FirstOrDefault();
if (imageContentLink != null)
// retrieve the image using the extracted items Id
LibrariesManager libraryManager = LibrariesManager.GetManager();
var image = libraryManager.GetImage(imageContentLink.ChildItemId);
if (image == null) return retval;
// return the image url to the template
retval = image.Url;
//dynamic resize
retval += "&size=150";
return retval;
I'll do a bit more fine-tunning on it, but the jist of it works.
Cheers.
There is also this for just front end use: <img src="<%# Eval("MediaUrl")%>&size=250" />
There is this for front end use: <img src="<%# Eval("MediaUrl")%>&size=150" />
Hello guys,
There has already been a discussion about this functionality about how to add custom sizes for image uploads here.
Regards,