Outputing graphics in HTML document 
Author Message
 Outputing graphics in HTML document

[mailed and posted]

Quote:
>I am having a problem getting a script to print out to the screen more than
>one graphic at a time.  The following logic is supposed to print at least
>seven GIF files side by side (I think).  At the present time, it is only
>printing out the first GIF file.  What is not working?
>Variables:
>      $giflocation = http://www.*-*-*.com/ ;   (Default)
>      $minLen = 7        (Default)
>      $count = 1735     (Number of accesses to my page)
>      $len = 7               (Calculated)
>      $formattedCount = 0001735            (Calculated)

>Logic:
>      $count = $totalReads;
>      $len = length($count) > $minLen ? length($count) : $minLen;
>      $formattedCount = sprintf("%0${len}d",$count);

>      print "Content-Type: image/gif\n\n";
>      for ($x=0; $x < $len; $x++) {
>          $digit = substr($formattedCount,$x,1);
>          open (GIF, "$giflocation$digit.gif") ||
>              warn "$0: unable to open $giflocation$digit.gif: $!\n";
>          select GIF;
>          select STDOUT;
>          print (<GIF>);
>          close GIF;
>      }
>Can someone please help.  I have been waiting for 2 weeks for our computer
>center to help, but have gotten no response.  I really need to get this
>program finished.  Please e-mail the responses to me directly instead of
>posting them to the newsgroup.  TIA

I think that unless you use a gif assembler program like ImageMagick you
will have problems with simply concatenating gif images.  You certainly
can't expect them to end up side-by-side.  You could probably do it with
a multipart mixed approach.

Wouldn't it be easier to do:

      print "Content-Type: text/html\n\n<HTML><BODY>";



                  print qq|<IMG SRC="$giflocation$_.gif" ALT="$_">\n|;
      }
      print "</HTML></BODY>";

It would even supply an alternate ASCII value 0 0 0 1 7 3 5 for
text-based browsers.  It has the advantage of being embeddable in HTML
documents, as well.

You also will have to make sure the $formattedcount value is a string --
from your "Variables" section, it isn't clear that the distinction has
been made.

Sounds like another counter, to me -- I am sure many would be happy
to let you stew. 8-)

Regards,
--
Mike Heins                                                    ___       ___
                                    Internet Robotics        |_ _|____ |_ _|
When the only tool you have is a    131 Willow Lane, Floor 2  | ||  _ \ | |  
hammer, all your problems tend to   Oxford, OH  45056         | || |_) || |  
look like nails.                                             |___|  _ <|___|  



Tue, 14 Apr 1998 03:00:00 GMT  
 Outputing graphics in HTML document
Quote:

>I am having a problem getting a script to print out to the screen more than
>one graphic at a time.  The following logic is supposed to print at least
>seven GIF files side by side (I think).  At the present time, it is only
>printing out the first GIF file.  What is not working?

You cannot concatenate the contents of the gif files under
one MIME section (inage/gif)
What you can do, is simply use inlined images wrapped in
an html file. See below.

Quote:
>Variables:
>      $giflocation = http://www.vanderbilt.edu/UReg/graphics/     (Default)
>      $minLen = 7        (Default)
>      $count = 1735     (Number of accesses to my page)
>      $len = 7               (Calculated)
>      $formattedCount = 0001735            (Calculated)

>Logic:
>      $count = $totalReads;
>      $len = length($count) > $minLen ? length($count) : $minLen;
>      $formattedCount = sprintf("%0${len}d",$count);

>      print "Content-Type: image/gif\n\n";

Change that to:
        print "Content-Type: text/html\n\n"

Quote:
>      for ($x=0; $x < $len; $x++) {
>          $digit = substr($formattedCount,$x,1);
>          open (GIF, "$giflocation$digit.gif") ||
>              warn "$0: unable to open $giflocation$digit.gif: $!\n";
>          select GIF;
>          select STDOUT;
>          print (<GIF>);
>          close GIF;

Change the above 6 lines to:
        print "<img src=\"$giflocation$digit.gif\">\n";
Quote:
>      }

That's it :-)

--
Peace, Ariel                                 http://www.yendor.com/



Tue, 14 Apr 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. outputing dir to html page

2. HTML Writer/Script Writers, Graphic Artists, Perl Programmers, and Sales Opportunities Available

3. Newbie simple question regarding graphics/charts display on an HTML page

4. Perl/Html - mixing text and graphics

5. needed: date stamp of a graphic file being loaded into an HTML

6. Mail with HTML and graphics

7. Loading graphics from print "html";

8. Name of calling html-document

9. Perl and document conversion to HTML ...SOLUTION?

10. Perl and document conversion to HTML

11. Parsing HTML Like Documents

12. Perl in HTML Documents

 

 
Powered by phpBB® Forum Software