Developer forum

Forum » Development » GetImage.ashx how it wokrs?

GetImage.ashx how it wokrs?

Dmitrij Jazel
Reply

Hi everyone,

We had a discussion about GetImage.ashx how it works and how it manages to parce images.

When it parses an image - does it create a "thumbnail" image automatically, so it does not needs to parse it again, but just return it at once.

Or 2) It parses "on the fly" and works more like a "filter". And does Not make any phisical copy, or thumbnail version of the image.

 

/Dmitrij


Replies

 
René Poulsen
Reply

Hi Dmitrij,

I don't know excatly how it works, but I do know that you can set a value in GlobalSettings, to indicate for how long you want to cache the image.

If you add the following to the "Settings" node, the image will be cached for 168 hours (that should be nough for Google PageSpeed Insights not to grumble over them :-)):

<ImageHandler>

    <CacheHours>168</CacheHours>

</ImageHandler>

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Dmitrij

GetImage creates a thumbnail for each combination of querystring settings and saves it in \Files\cache.net\images - when you request the image the second time it comes from this cache. If the file changes or gets reuploaded, the thumbnails are recreated.

The cache setting René mentions has an effect on the expires header sent to the browser, and will let the browser use cached versions for specified TTL saving browser and server time. You can do that if images do not change all the time.

NP

Votes for this answer: 1
 
Dmitrij Jazel
Reply

Thanks for the info Nicolai,

Nice to know that, maybe this info could be added into documentation?

http://manual.dynamicweb-cms.com/Dynamicweb-On-line-Manual/Management-Center/Designer/Image-handler.aspx

 
Dmitrij Jazel
Reply

And Than a question,

What if we have a remote location, accessible via "Virtual folder" 

I tryed using it, and it is not able to find image, although I am able to reach the image, via website and normal request (one withouht getimage.ashx).

F.Eks. www.myserver.com/virtualfolder/image.jpg returns image no problem

but if i try using something like this www.myserver.com/admin/public/getimage.ashx?Image=/virtualfolder/image.jpg&amp;height=260&amp;width=260

it returns http 404.

 

Any tips and tricks for solving something like this?

 

/Dmitrij

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Oh, 1000 issues when doing that.

GetImage will do a mappath for /virtualfolder/image.jpg to find its location on disk. That happens in the context of the application pool running the website. That pool has a user attached that runs the process. Doing a mappath to a shared ressource happens as that user, and then you run into a whole lot of permission issues you need to address on your AD. So make sure the app pool runs as a user that has the right previleges. Soo google and iis.net

BR Nicolai

Votes for this answer: 1
 
Dmitrij Jazel
Reply

Thanks for answer Nicolai,

Will have it done from here on :)

Appreciate it

/Dmitrij

 

You must be logged in to post in the forum