Developer forum

Forum » CMS - Standard features » Limit imagehandler to only effect certain types of images

Limit imagehandler to only effect certain types of images

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

Is it possible to limit the imagehandler - getimage.ashx - to only effect certain filtetypes - eg. only .jpg?

 

/Hans


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply
This post has been marked as an answer

Hi Hans,

 

You can do that checking is the string ends with jpg or not. Example:

 

var filepath = GetString("...");

var imgSrc = filepath;

if (filepath.EndsWith(".jpg") {

    imgSrc = "/admin/public/GetImage.ashx..." + filepath;

}

 

Best Regards,

Nuno Aguiar

Votes for this answer: 1
 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi Nuno

Thanx for your reply. Yes, that is ofcourse possible.

Thank you.

 

You must be logged in to post in the forum