Ok, here's a weird one for ya: I want to streamline a program I'm writing to make it as simple (low # of files) as possible. Is it possible to store an image in a variable in my class? And how exactly would it be displayed from that point if it's possible?

Thanks

Jeof

    You could; but where would it come from?

      Originally posted by Weedpacket
      You could; but where would it come from?

      could you get it from a mysql database ?

        See, I want to be able to roll out this program (it's most a class) without having a bunch of other files to install. This image would be a logo on an error message box - and I just want it to show up without it having to be in a special place - or having the user change it easily - so i was thinking if i could just store the data of the image (a really simple gif or jpg- nothing big or fancy) in a variable in the program, they couldn't get at it so easily.

        It's really a fantisy idea - but if it's remotely possible it would be cool.

          Originally posted by jeofoyster
          See, I want to be able to roll out this program (it's most a class) without having a bunch of other files to install. This image would be a logo on an error message box - and I just want it to show up without it having to be in a special place - or having the user change it easily - so i was thinking if i could just store the data of the image (a really simple gif or jpg- nothing big or fancy) in a variable in the program, they couldn't get at it so easily.

          It's really a fantisy idea - but if it's remotely possible it would be cool.

          what about if you had the image remotely hosted somewhere and the script just had a link to it. save the link as a variable and use it wherever you want.

            Granted, I could do that, but that's not nearly as cool. 🙂 Plus, I really want it to be as self-contained as possible - and not dependent on remote files.
            Anyone have any ideas?
            Jeof

              I still want to know where the image data will be when the script isn't running - and how the script gets that image data into the variable in the first place. Are you going to have a big array of numbers in the class file to represent the image data? That would be fun to alter. $image=array(0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x5f, 0x00, 0x69, 0x00, 0xf6, 0x00, 0x00, 0x00, 0x00, 0x00...);. As for storing it in a database, not only is that a bad idea, but it still needs to be on hand to put it in the database in the first place - and what about the database schema?

              Spitting out binary data is easy enough, just send a suitable header so the browser knows what to do with it, and send bytes (if you want to send a byte 0x54, just echo chr(0x54);, etc.). Then use the script name in the <img> src attribute, along with whatever would be necessary to get the script to output the image data instead of doing something else.

              It still seems like a needless waste of effort, though. Maybe something along the lines of php-package might be a better way to go.

                Write a Reply...