in reply to Embed GIF in perl source?
Firstly, you're probably better off putting the images in separate files. This is mainly for a maintenance reason. Somebody coming along later needing to update your script because one of the images needs to be updated is going to have a hell of a time doing it. If your CGI script is being used in an image context, you're better off having the CGI script open a real .gif file on your local filesystem and just sending the data to the browser.
Secondly, your example of &showgif(1) makes me wonder if you are hoping to be able to use this function multiple times in your CGI script. If so, you can't. Your CGI script can only output a single content type (unless you want to go with some multipart encoding, but I don't know if browsers have enough of a sophisticated support for that sort of thing to be able to interpret it in a way that would make what you're trying to do remotely useful). Any attempts to display multiple GIFs one after the other will fail, because the browser is expecting and assuming the content from that request will be a single item.
You may also wish to take a look at, say, MIME::Base64, which will let you encode/decode binary items in such a way so as to continue to be printable (which seems to be your goal) while being a bit more efficient space-wise than a simple hex string. It'll also take slightly longer to process.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Embed GIF in perl source?
by epoptai (Curate) on Dec 08, 2000 at 15:53 UTC |