Page 1 of 1

page.php?img=...jpg <- How to place an image after a file

Posted: Mon Nov 10, 2008 9:09 am
by digi-what
Hello.

I am trying to have a php file load an image so it appears in the lURL. Such as: file.php?img=1.jpg

If anyone knows an easy solution to this, please let me know. Some sites say I have to encode it to base64, and if that is the case, how would I encode it to create an image with the above URL?

Thank you

Re: page.php?img=...jpg <- How to place an image after a file

Posted: Mon Nov 10, 2008 9:16 am
by aceconcepts
You could send the file as seperate variables: ?filename=pic1&ext=jpg

Use explode to seperate the filname and ext by use of the fullstop:

Code: Select all

explode(".", $filename);

Re: page.php?img=...jpg <- How to place an image after a file

Posted: Mon Nov 10, 2008 10:14 am
by mmj
digi-what wrote:Hello.

I am trying to have a php file load an image so it appears in the lURL. Such as: file.php?img=1.jpg

If anyone knows an easy solution to this, please let me know. Some sites say I have to encode it to base64, and if that is the case, how would I encode it to create an image with the above URL?

Thank you
Where are the image contents stored?

You can have it stored in a db the php file or just read an image file and it would work. You just have to send the appropriate headers.

Re: page.php?img=...jpg <- How to place an image after a file

Posted: Mon Nov 10, 2008 11:10 am
by digi-what
How would I place the image into a mysql table?

As a file blob in base64 format? All the images are jpgs, so how would I convert that properly, and then take it out of the table to read: xxx.php?img=xx.jpg?

Re: page.php?img=...jpg <- How to place an image after a file

Posted: Mon Nov 10, 2008 12:25 pm
by mmj
digi-what wrote:How would I place the image into a mysql table?

As a file blob in base64 format? All the images are jpgs, so how would I convert that properly, and then take it out of the table to read: xxx.php?img=xx.jpg?
You must have a specific reason for wanting to store them specifically in a database.

You can store binary data in mysql, its called blob