php - Displaying an image with different name -


on website let users upload images.

i save images under hashed (based on name + timestamp) name.

i store both original name hashed name in database.

i display image on page using original name.

case

  • user uploads test.jpg
  • image saved /img/6eabd22d35b4132cc58e4dff75e466cc1e444d93053ca80087b12ff620bd3451 on server
  • both original , hashed names stored in database
  • display image on page using original name (<img src="/img/test.jpg" alt="" title="">) /img/6eabd22d35b4132cc58e4dff75e466cc1e444d93053ca80087b12ff620bd3451

is possible?

yeah, that's possible. it's quite easy, have to:

  • rewrite requests conform pattern (php) script using apache module mod_rewrite;
  • in script fetch real name database , display image. don't forget send correct header, otherwise won't work.

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -