Sign in

E-mail *, (xx@domain.com)
Password *

Register | Forgot password

Image download link

The "WCB: JSP front-end design" forum contains threads on issues that are related to JSP front-end design while programming a WCB (WebManager Component Bundle). The Presentation & Element component contain JSPs that will be used for front-end rendering. Ask your questions related to these JSPs here. Some example topics: integration of AJAX, use of the taglibs, how to handle multiple websites, and so forth.

Answered
Not marked as answered yet

Forums  >  WCB: JSP Front-end design  >  Image download link


Author Image download link
johnsten



Posts: 59

Posted: 23-07-2010 11:25

I have a mediacollectionelement that show's sizedImages from the objectmanager (Image).

The problem now is that they also whanna have a link to download the full Image. Is this possible to convert the image url to a download url?

michael



Posts: 13

Posted: 27-07-2010 10:41 Helpful

I'm assuming you are using media articles with object manager lead images since the mediacollectionelement does not support looping over object images directly.

the non-resized image can be retrieved using (when looping over the media articles in te mediacollection jspf):
mediaItemVersion.leadImage.url

the resized version can be found using:
mediaItemVersion.leadImageMediaItem.current.thumbNailImage.url

these can both be used as a download url, check the webmanager api for details:
http://api.gxwebmanager.com/javadoc/nl/gx/webmanager/cms/mediarepository/MediaItemVersion.html

Also make sure you test that an image has been assigned to prevent errors, like this:

<c:if test="${showImage && (not empty mediaItemVersion.leadImageMediaItem) && (not empty mediaItemVersion.leadImageMediaItem.current.thumbNailImage) && (not empty mediaItemVersion.leadImageMediaItem.current.thumbNailImage.url)}">
<img src="${fn:escapeXml(mediaItemVersion.leadImageMediaItem.current.thumbNailImage.url)}"

johnsten



Posts: 59

Posted: 27-07-2010 16:03

since the mediacollectionelement does not support looping over object images directly.



If you select image as content type in a media overview it's possible to loop true images from the objectmanager.

But i've checked the api and there i can only find the url and absolute url. What i whanna achieve is to convert the url to a download url. Just like the download element.

williamb



Posts: 310

Posted: 27-07-2010 21:52 Helpful

Hi Johnsten,

what you get with both url's are the only way (standard) to retrieve the image. The rest is up to Apache (or IIS, etc. if you use that one).

Your problem is that the server sends something like:
'Content-Disposition: inline (or nothing at all)
instead of
Content-Disposition: attachment

What you might do (one of the many solutions) is to:
step 1. modify the url a bit, into e.g. something.jpg?download=true
step 2. let apache know (via .htaccess) that the querystring '?download=true' needs to send the header 'Content-Disposition: attachment'.


Back to top

New message: "Image download link"
Message:
bold boitalicd underline url quote code smile cool eek grin mad razz sad wink
 
© 2012 GX Software B.V.

Disclaimer

This website (Connect.gxsoftware.com) may discuss or contain opinions, (sample) coding, software or other information that does not include GX official interfaces, instructions or guidelines and therefore is not supported by GX. Changes made based on this information are not supported.  GX will not be held liable for any damages caused by using or misusing the information, software, instructions, code or methods suggested on this website, and anyone using these methods does so at his/her own risk. GX offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this website, including any liability resulting from incompatibility between the content of this website and the materials and services offered by GX. By using this website you will not hold, or seek to hold, GX responsible or liable with respect to the content of this website.