Re: [PHP] Re: getimagesize() & MySQL Image Storage (Running functions on contents of variables)

From: Galen (phplist_at_zinkconsulting.com)
Date: 12/07/03

  • Next message: Playerfr: "Can I request ?"
    Date: Sun, 7 Dec 2003 08:13:31 -0800
    To: php-general@lists.php.net, Justin Patrin <papercrane@reversefold.com>
    
    

    So you're saying there's no way to do what I want to do.

    Anybody got any other ideas?

    It seems so stupid to be unable to run functions that accept files on
    variables, with so many people using databases and whatnot these days.

    -Galen

    On Dec 7, 2003, at 1:46 AM, Justin Patrin wrote:

    > Galen wrote:
    >
    >> I'm using a MySQL database to store images as BLOBs. I know how to
    >> handle all the MySQL stuff, it's easy, and really makes keeping track
    >> of files nice an clean. No permissions, no risk of getting things out
    >> of sync, finding stuff is as easy as SQL.
    >> My question is about handling stuff once you pull it out of the
    >> database. When I store images in the database, I currently stash the
    >> format and the resolution in the database, which works but is a bit
    >> messy. I can't find any easy way to run getimagesize on the contents
    >> of a variable, not a file. I could write the image to a file if I
    >> needed to, but that can be slow and rather inelegant, I'd rather
    >> store the values in the DB. Any ideas on how I could use getimagesize
    >> or similar function to determine the format and resolution of the
    >> image in a variable?
    >> I have had a similar problem with ftp uploading. There was no way to
    >> upload the contents of a variable, so I had to write everything to
    >> the disk, kind of annoying when I have 1,000 files. The script wasn't
    >> a very heavily used script nor could the public execute it, but it
    >> bugged me to no end. I think there are some other functions that also
    >> only operate on files and I've fought with them too.
    >> Is there any kind of generic solution for this? Some kind of wrapper
    >> I could use to make a variable act like a reference to a file but
    >> actually be in memory only?
    >> If this seems totally pointless, please tell me. But it seems like
    >> there should be a way for almost any function that runs off a file to
    >> run off the contents of a variable, it's just binary data.
    >> Thanks,
    >> Galen
    >
    > If the programs read from a file descriptor, you could open a pipe,
    > write into it on your side, and have the command read from it. But
    > that's really messy... and won't work for the image size function.
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >
    >


  • Next message: Playerfr: "Can I request ?"

    Relevant Pages