Jump to content

Converting image Resourse to stream Resource


benjam

Recommended Posts

I am trying to upload an image from an html form and then resize that image and save the image (not the filename, but the actual data) to a database.

I can do it just fine by opening the file, reading the contents, and uploading the contents to the database, but when I try to resize the image (which I can also do just fine) and then try to read the contents of the GD resource, I cannot get the actual data back out in a string (binary) format to be saved in the database.

So my question is this:
How can I read the data from the resized image resource so that I can save it to the database?

Thanks for any help.
thats difficult but caption ck would tell you how to do it without telling you the script

1st Use the script to save the uploaded file somewhere

2nd Create a page which uses the GET method to get the file name and it shows the image resized

3rd The first script should get the contents of the 2nd script after giving it the get parameters (eg fread("image.php?url=uploads/pic.gif&h=100&w=100", filesize("image.php?url=uploads/pic.gif&h=100&w=100")); )

4th Now save the fread data in the database

5th Delete the image which was used to resize (uploaded image)

END

I know this would take time and i dint give you the script, cause its getting around 12am here and i have school tomorrow and hav to get some sleep.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.