Developer forum

Forum » Templates » fetch modified/edit timestamp on image in razor

fetch modified/edit timestamp on image in razor

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

I have a razor template where i loop through images of a given folder, and publish it to a JSON feed. I wonder if it would be possible to fetch the timestamp of the image file (the time when the file was last edited) in the loop. Anyone know if this is possible? I would like to add it to the image instance in the json feed like this http://website.com/image.jpg?time=123455 - so the receiver of the json feed will now when the image was last edited, and so that if the image is edited, the URL will change - without changing the filename.

Is this doable?

 

BR
 

Hans


Replies

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Sorry :)

I will answer my own question. Have not tried it, but seems it is a fairly simple task to achieve -

here are some examples - https://stackoverflow.com/questions/23243336/how-to-get-file-created-date-and-modified-date

If you have any inputs tough, youre welcome :)

 

You must be logged in to post in the forum