View Single Post

  #5 (permalink)  
Old 01-23-2006
Gnutt Halvordsson
 
Posts: n/a
Default Re: Getting image data as a variable

> 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.
How? I've tried this a numerous times, and currently I write the images
to a temporary file, and then reads the data from that file (and puts it
in the database).

--

The work is done when uploading a image to the server, and then saved
into the database. This is to make it much easier for me to backup the
site. Since I don't have local access to the site, and still want to be
able to write bakcupscripts, so that I have a backup of the site every
now and then. This way, all I need to do is keep a working copy of the
code, and then take a backup of the database every now and then in order
to keep my backup up-to-date.

d skrev:
> "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 :))
>
>

Reply With Quote