Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Direct path to media library image in transformation View modes: 
User avatar
Certified Developer 10
Certified Developer 10
varinder-kudosweb - 1/31/2012 4:56:28 PM
   
Direct path to media library image in transformation
Hi,
Im using a media selection field in a document type upload images.
Is there any way to get the direct path path to that in transformation?

Eval("Image") gives me:
~/getmedia/cffee938-eee0-40fe-805c-a21c9b49aba2/GalleryImage1Thumb.jpg.aspx?width=132&height=126&ext=.jpg

Is there any way to get a url which is something like this:
/Website/media/images/GalleryImage1Thumb.jpg

Cheers Varinder

User avatar
Kentico Support
Kentico Support
kentico_janh - 2/1/2012 3:33:29 AM
   
RE:Direct path to media library image in transformation
Hello,

Actually, the information about an image from media gallery is taken from database and these images are stored there under their GUID number, which is present in the first URL you have posted. But you can notice, that there is another tab called Content (when you are selecting an image for you document type) and under this tab you can choose an image from your content tree and also its path will be physical as you wanted.

Best regards,
Jan Hermann

User avatar
Certified Developer v7
Certified  Developer v7
jessica-thepixelshop - 6/6/2012 2:20:29 PM
   
RE:Direct path to media library image in transformation

Hi there,

I am having a similar issue, however, I don't understand the relevance of using the content tab instead of the media library tab to select content, when the question was about transformations and what functions can be called.

I have created an email template that uses a transformation to display a list news articles, formatted (image, title, summary). The Eval function is returning the permanent url, and have I added the GetAbsoluteUrl function because this an email template.

The main issue is that not all mail clients will display the image with the extension .aspx
Could you please tell me how I can get the direct path of the media selection ("MainImage").

Example:
<a href="<%# Eval("URL") %>" alt="<%# Eval("AlternativeText") %>">
<img src="<%# GetAbsoluteUrl(Eval("MainImage").ToString()) %>" alt="<%# Eval("AlternativeText") %>" width="80px" height="80px" style="display:block; margin:0; padding:0; border:0px;" />
</a>

Is there a function that will return the path to a file [media selection] formatted like:
/Website/media/images/GalleryImage1Thumb.jpg
/Website/media/reports/News_release.pdf

Cheers.
Jessica

User avatar
Kentico Support
Kentico Support
kentico_janh - 6/7/2012 2:59:39 AM
   
RE:Direct path to media library image in transformation
Hello,

Yes it is. All you need to do is to set the Use permanent URLs property in Site Manager -> Settings -> Media libraries to false. (If you have already uploaded some images, you would need to update or reupload them)

Best regards,
Jan Hermann

User avatar
Certified Developer v7
Certified  Developer v7
jessica-thepixelshop - 6/7/2012 4:17:12 PM
   
RE:Direct path to media library image in transformation
Thank you for your help.

User avatar
Member
Member
philliptune - 4/17/2013 11:33:06 AM
   
RE:Direct path to media library image in transformation
Is there a way to drop the /[site name] in ~/[site name]/media...? Say, for users who only have one website on the server and want to skip straight to ~/media/imgs/myimg.jpg.

User avatar
Kentico Support
Kentico Support
kentico_janh - 4/18/2013 4:08:15 AM
   
RE:Direct path to media library image in transformation
Hello,

In the Site Manager -> Settings ->Content -> Media section there is the Media libraries folder property where you can set any folder for your media files you want.

Best regards,
Jan Hermann

User avatar
Member
Member
philliptune - 4/18/2013 7:50:56 AM
   
RE:Direct path to media library image in transformation
So that setting is not to direct it to a physical file, but rather is setting what the filepath should be named?

User avatar
Member
Member
philliptune - 4/18/2013 7:53:09 AM
   
RE:Direct path to media library image in transformation
Well the tooltip says this:

'Physical path to the folder where root folders of all media libraries should be stored. For example "~/Libraries", "c:/Libraries" or "\\\\servername\\Libraries". If empty "~/[site name]/media" will be used.'

So it makes it seem like it is looking for a Phisical file path, not setting a new one.

User avatar
Kentico Support
Kentico Support
kentico_janh - 4/19/2013 3:13:17 AM
   
RE:Direct path to media library image in transformation
Hello,

Don't worry, this set a new location for your media files and when you upload a new one it will be stored in this folder.

Best regards,
Jan Hermann

User avatar
Member
Member
philliptune - 4/19/2013 9:55:01 AM
   
RE:Direct path to media library image in transformation
Well wonderful. Thank you Jan, I'll start playing with that.

I'm really glad you guys added the Media and Javascript libraries. Am I right in assuming that images uploaded to the tree were being stored in the database (as like base64 or something) and files in Media actually save to the filesystem?

Also, the Javascript library is great to be able to edit javascript on the fly instead of having to edit on a local box and upload everytime there's a change.

User avatar
Kentico Support
Kentico Support
kentico_janh - 4/22/2013 2:39:05 AM
   
RE:Direct path to media library image in transformation
Hello,

By default yes (files -> attachments -> database, media -> file system), however you can change it for files in the Site Manager -> Settings -> System -> Files.

Best regards,
Jan Hermann

User avatar
Member
Member
philliptune - 4/22/2013 8:00:47 AM
   
RE:Direct path to media library image in transformation
Thanks Jan! Great information.

User avatar
Member
Member
philliptune - 4/19/2013 12:08:21 PM
   
RE:Direct path to media library image in transformation
Actually, no dice Jan. I renamed it to "~/libraries" and it is now saving all my files to /libraries/[site name]/img/myimg.jpg. Any other thoughts?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 4/19/2013 3:24:29 PM
   
RE:Direct path to media library image in transformation
Hi,

Is the setting right below this one set to true? This one indicates whether the site specific sub-folder should be used in case the main folder is shared with other sites. You should set to false the "Use site-specific subfolders for custom media libraries folder" setting.

Best regards,
Juraj Ondrus

User avatar
Member
Member
philliptune - 4/19/2013 3:28:54 PM
   
RE:Direct path to media library image in transformation
Now we're playing with fire. I've been through these settings so much I just glossed over that checkbox. Thanks Juraj.

User avatar
Certified Developer 10
Certified Developer 10
varinder-kudosweb - 4/2/2014 2:48:17 AM
   
RE:Direct path to media library image in transformation
Sorry to dig this up.

There are quiet a few images uploaded already. Is there a way to get permanent url based on NodeGuid?

User avatar
Kentico Support
Kentico Support
kentico_janh - 4/8/2014 2:54:06 AM
   
RE:Direct path to media library image in transformation
Hello,

the media files have nothing to do with documents in content tree, so they don't have NodeGUID or NodeID or even any DocumentGUID/ID, however you can get the permanent url using media file GUID in the url when you turn the Site Manager -> Settings -> Content -> Media -> Use permanent URLs setting on.

Best regards,
Jan Hermann

User avatar
Certified Developer 10
Certified Developer 10
varinder-kudosweb - 4/8/2014 4:31:48 PM
   
RE:Direct path to media library image in transformation
Ok, sorry i failed to explain correctly. Heres goes again:

- There are whole bunch of media images already ( which means i can not turn permanent url setting on )
- Is there *any* way to get permanent url of a media image via GUID? something like GetMediaPath( GUID ) ?

Again, sorry for confusing GUID with NodeGUID.
So yea, in summary - for a given media file's GUID, can i get its permanent path?

Thanks