|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Hello there,
I am finding it difficult to produce images. I am using perl and html. Should I give a different html header when i have to display an image. At present I give the header "content-type:text/html" Please help Thank u Dups |
|
#2
|
|||
|
|||
|
Could you be a little more specific. For example, show some of your code. The problem could be elsewhere and you are just missing it.
![]()
__________________
- dsb - ![]() Perl Guy |
|
#3
|
|||
|
|||
|
I assume you mean opening and printing an image with perl
Code:
$file = '/path/to/image.jpg';
print "Content-type: image/jpeg\n\n";
open(A,$file) or die($!); # Die statement wont do much in an image
while( <A> ) {
print;
}
close(A);
You can't print an image and html with the same script call. You'd have to make your html output page make an <img src> call to a perl script that will just print the image content type and the image. |
|
#4
|
|||
|
|||
|
Hello there,
I am sorry, I didn't explain my problem clearly. In my perl script, I am using the following html code. <IMG SRC="31a.jpg" ALT="image" ALIGN=TOP>jpeg Then in my browser I can't see the image. But I can see an icon named "image" instead. If I set a background image as follows <body background="31a.jpg"> The background will be my default setting and my background image is not seen. What could be the problem? Please help. Thank u Dups |
|
#5
|
|||
|
|||
|
Hello,
Image named 31a.jpg might not be existing in the same path where your perl script is running or you might have given wrong path as source of image i.e., the reason alternate text is displaying. Here is the simple code if your image is on the desktop, #!/usr/bin/perl print "Content-type:text/html\n\n"; print qq~ <html><body bgcolor="#ffffff" text="#000000" id=all> <IMG SRC="c:\\windows\\desktop\\31a.jpg" ALT="image" ALIGN=TOP> </body></html> ~; |
|
#6
|
|||
|
|||
|
Hello there,
I gave the full path. Still there was no change. Should I make anychanges in the settings of my netscape browser? Thank u Dups |
|
#7
|
|||
|
|||
|
this is just a guess, but, if you do have your images in your cgi-bin, alot of times that is not allowed in cgi.. hence they will not show up.. so that might be the source of your trouble, if so, remove them from your cgi-bin, place them in your public_html folder(via uploading in binary)then place the full path to the public_html directory in your html..
|
|
#8
|
|||
|
|||
|
look at page source code
look at page source code in your Netscape, is it right?
|
|
#9
|
|||
|
|||
|
Hello,
Yes,Browser settings may be the problem. just check your netscape browser settings for gif and jpeg type images are enabled or not. You can do it using Edit -> preferences ->Navigator -> Applications. bye |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > showing images using html and perl |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|