Hi

I'm new to using to GD library but have been able to make an image (for my background) with this header:

header ("Content-type: image/png\nContent-Disposition: inline; filename=bg.png");

Does anyone know of a way of adding the other information often found in png files?

For example, if I save this file from the browser and look at its properties in PaintShop Pro, it shows these fields blank:

Image Title
Artist Name
Copyright
Description

Can these be set in the headers sent by the server from my image making script?

I can't use a watermark because the image is too small (it's a tiled background image) and replicated all over the background.

Trevor

    Um, I never thought of taking this approach. I can't say it will or will not work, but I'm not sure what you'd set. The header info is extra data sent to the browser so the browser knows what to do with the encoded or binary data that is to follow. By putting in extra data, it'll get sent to the browser, but if the user was to save the image, I don't believe your extra header info would get saved with it. You would have to embed that data in the image itself. Most image formats include their own headers within the file itself. You'd need to write your info in there depending on the file format you're working with.

      Originally posted by AstroTeg
      Um, I never thought of taking this approach. I can't say it will or will not work, but I'm not sure what you'd set. The header info is extra data sent to the browser so the browser knows what to do with the encoded or binary data that is to follow. By putting in extra data, it'll get sent to the browser, but if the user was to save the image, I don't believe your extra header info would get saved with it. You would have to embed that data in the image itself. Most image formats include their own headers within the file itself. You'd need to write your info in there depending on the file format you're working with.

      Hi

      What you say makes sense. If so, then does the GD library have such a function? I can't see any. I wonder if I took an existing image and saved the necessary bits to it whether that would do it.

      Ah well, back to the drawing board.

      Trevor

        I don't think the GD library will do this. But using PHP's file functions in binary mode, you should be able to write your own bits and bytes to the file.

          Hi AstroTeg

          mmm. The only problem with that is that I have to save the file first, then open it and edit it, then use it. I want to avoid that because of the dynamic nature of the requests for the file (each user will be different).

          I will experiment with a base file with the neccessary binay data already in, open that and modify the size and colors with the GD library and see what gets sent.

          Still, it strikes me that the library ought to have this functionality.

          Trevor

            Write a Reply...