Re: Getting image data as a variable
"Gnutt Halvordsson" <gnutt@shell.linux.se> wrote in message
news:RCVyf.154118$dP1.512537@newsc.telia.net...
> The problem lies in that I want to use database explicity for putting up
> images on a blogsite (i don't want to use the filesystem what-so-ever)
> (mostly to save myself from having issues with duplicate filenames, and
> when I delete one, both goes.)
>
> Image is loaded via a web-form, and are to be resized. Currently I save
> the images on a folder which everyone has write and execution-access to.
>
> Images are resized via the imagecreatetruecolor() and
> imagecopyresampled(), and then written to the filesystem. After that read
> into variables, which in their turn is written into the database.
>
> Is there any way for me the skip the filesystem-bit?
Yes - don't write them to the filesystem. You can use imagejpeg to return
the actual image data as a string, which you can then put in the database.
> Help much appriciated.
> //Gnutt
(this isn't a lecture but an offer of help: making so much work for each
and every request is not a great idea - if you can do the work once when you
add/remove images, your web server would thank you :) I'm not having a go,
I just don't see the benefit - it's pretty easy to make scripts reliable
enough to overcome missing images (should that ever happen) and duplicate
filenames... if you tell me what your actual concerns are, maybe I can help?
I worked at a company that had several hundred gigabytes of images, all
indexed by database, so I have a bit of experience with this, not that I'm
saying you don't :))
|