Jump to content
MakeWebGames

Recommended Posts

Posted

I'm using GD to re-create an image from a url. The only problem is instead of serving the image from blah.php?id=imgid, i want to serve it from md5'd id-picname.png .

How can this be accomplished?

Posted

So you don't want the filename in the argument but some... hash? well you can't directly

you must store the full path in a db with as key an hash (md5 or whatever) and then you can use that to find the true path.

Posted

THe hash isnt really what im trying to say. Im just saying how would i get the image to come out at .png instead of .php ? so i could access it like image.png instead of images.php?image=theimage

Posted

so either you use a mod rewrite for something like

/myimg/img.png which would be then pointing at myphp.php?image=img.png

or you could use a the PATH_INFO to have an url like

myphp.php/img.png

Is it what you are looking for?

Posted

this is mainly what i used..

 

 RewriteEngine on
 RewriteRule ([0-9a-zA-Z])\.png$ /images/?id=$1

 

and of course the image is fetched by the id of user, and some other variables all mixed up for reasons.

Posted

By doing so:

RewriteEngine on
RewriteRule ^/users/([0-9a-zA-Z])\.png$ /images/?id=$1

 

You say that only the urls with /users/XYZ.png will be converted what doesn't start with /users/ will not (it is just an example). I you just say whatever ends by .png will have way too many matches and could be counter productive.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...