Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Media Library Image URL's Change to Permanent URL's When Changing Width View modes: 
User avatar
Member
Member
scott_hancock-urmc.rochester - 8/1/2012 12:40:16 PM
   
Media Library Image URL's Change to Permanent URL's When Changing Width
Hi,

One of my editors noticed that when he edits the width of an image when inserting it in a page, the url changes from relative to a permanent URL. This happens when he is inserting an image or is editing one that has already been inserted into a page. Here are the steps to reproduce:

My image is 720 wide and 480 high.
The path is: /Training/media/Kentico-Class/images/baby.jpg
The "Use permanent URLs" setting in CMS Site Manager is unchecked.

1. Click Insert/Edit image or media.
2. Click the "Media libraries" tab.
3. Locate an image and click the "Select" icon for it.
4. On the "General" tab change the height to 72. The width automatically changes to 48.
5. Click in the "Alternate text" box. (Any of the other boxes will do also).
6. The "URL" field changes to "/getmedia/c28a1dc9-fd11-46c4-9648-658f12e595dd/baby.aspx?width=72&height=48"
7. Changing the width to "721" (or other small increments) doesn't cause it to happen.

Any idea why this is happening?

Thanks,
Scott

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 8/2/2012 2:37:06 AM
   
RE:Media Library Image URL's Change to Permanent URL's When Changing Width
Hello,

The image URL is changed to a permanent one, because it needs to be processed by the system. Otherwise it's a direct link to the file system and the image is only displayed, without any additional processing in the CMS.

Best regards,
Boris Pocatko

User avatar
Member
Member
scott_hancock-urmc.rochester - 8/2/2012 7:22:38 AM
   
RE:Media Library Image URL's Change to Permanent URL's When Changing Width
What is this additional processing?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 8/3/2012 2:06:33 AM
   
RE:Media Library Image URL's Change to Permanent URL's When Changing Width
Hello,

The additional processing is the resizing of the image. So you can either use the full sized image and resize it with some css, and you can keep the 'nice' URL to the image, or you can use our internal resizing, however you have to use the permanent URL format in that case.

Best regards,
Boris Pocatko

User avatar
Member
Member
scott_hancock-urmc.rochester - 8/3/2012 9:53:03 AM
   
RE:Media Library Image URL's Change to Permanent URL's When Changing Width
Hi,

I didn't realize what was happening in the background.

When you are inserting an image from a media library:

If you set the width or height larger, it just inserts it normally, resizing it with css.

<img alt="" src="/MediaLibraries/MyLibrary/test.jpg" style="width: 250px; height: 164px;" />

If you set the width or height smaller, it creates a new file in a __thumbnails folder (in the same directory as the original image) and changes the url to use getmedia.

<img alt="" src="/getmedia/5ee23f02-2702-4f75-9291-05d6629fd304/test.aspx?width=25&height=16" style="width: 25px; height: 16px;" />

If you delete the image in the editor, the thumbnail will not be deleted. So you could end up with a lot of files in the __thumnails folder that aren't used.

If you delete the __thumbnails folder, the images won't break, the folder and image will be recreated the next time it's requested by the browser. That would be one way to get rid of unused thumbnail images.

Why does the system do this? I understand that resizing the image in CSS will cause pixelation but I could just resize the image myself. Why does it only do it when you make it smaller? Is there any way to turn this off?

I searched through the documentation and I can't find any reference to this functionality. You should add it to prevent confusion.

Thanks,
Scott

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 8/8/2012 4:24:38 AM
   
RE:Media Library Image URL's Change to Permanent URL's When Changing Width
Hello,

I've checked with our developer and he explained, that we don't resize the images to a bigger version, because it could be exploited to bring down the server. E.g. resize the image to 1000000 height and 1000000 width. The image is resized to a smaller version, because it saves bandwidth. You can override this behavior by setting the getPermanent variable in the method btnImagePreview_Click within the file CMSModules\Content\Controls\Dialogs\Properties\HTMLMediaProperties.cs to false.

We will also update the developers guide to include the information about changing links.

Best regards,
Boris Pocatko