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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

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.