Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

So, how can I print out image? It works if it is .gif file, but .jpg and animated .gif is problem I open image file by standard open and while commands and print it out. Header is image/gif and for jpg is image/jpeg image/jpeg starts to ask if i want to download it. OK, yes I can put there Location: to header to point to my image file in www, but this wat I do not want to do. If it is possible , please send reply to margus@cc.ttu.ee

Replies are listed 'Best First'.
Re: Problem with images
by turnstep (Parson) on May 03, 2000 at 17:00 UTC

    Try using 'image/jpg' (no E in jpg). As far as animated gifs, there should be no difference between an animated and a non-animated. If it is still a problem please describe the exact string you are using to output the content header.

    Update: Bleh. What was I thinking? The replies below are right, it's image/jpeg.
      I've never seen any document that permitted 'image/jpg' as a registered MIME type. Are you sure you aren't confusing suffices with MIME types?

      -- Randal L. Schwartz, Perl hacker

      Try using 'image/jpg' (no E in jpg).

      *cough*you can have the E as well*cough*

      From mime.types:

      image/jpeg                      jpeg jpg jpe

      Cheers,
      KM

        There is also an image/pjpeg for progressives jpegs.

        Cheers,
        Ovid

        Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Re: Problem with images
by athomason (Curate) on May 03, 2000 at 16:57 UTC
    What exactly are you sending as the http header? For jpg's, it should be "Content-Type: image/jpeg\n\n". Case will matter. If you're using CGI.pm, header(-type=>'image/jpeg') should do. I've got a script that dynamically generates jpgs through Convert::UU; the above works for me.