473,672 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to display image using perl CGI

3 New Member
Hi,
I am trying to display image , but its not working.
Expand|Select|Wrap|Line Numbers
  1.  
  2. #!C:/Perl64/bin/perl.exe 
  3. print "Content-type: image/gif\n\n"; 
  4. print <<EOF; 
  5. <HTML> 
  6. <HEAD> 
  7. <TITLE> Coding Page </TITLE> 
  8. </Head> 
  9. <BODY> 
  10. <P>Image uploading 
  11.  
  12. <a href="/cgi-bin/image.cgi?image=create_form.gif"> 
  13. <a href="/cgi-bin/image.cgi?image=en.gif"> 
  14. </BODY></HTML>   
  15.  
  16. EOF 
  17. exit;
  18.  
I have tried image sourse tag also.
Expand|Select|Wrap|Line Numbers
  1.  
  2. #!C:/Perl64/bin/perl.exe 
  3.  
  4. print "Content-type: image/gif\n\n"; 
  5. print <<HTML; 
  6. <html> 
  7. <head> 
  8. <title> A Simple Perl CGI </title> 
  9. </head> 
  10. <body> 
  11. <img src="en.jpg" width="225" height="225" /> 
  12. <h1>A Simple Perl CGI </h1> 
  13. </body> 
  14. HTML 
  15. exit;
  16.  
Can somebody guide me with this problem.

Zulfi.
Nov 14 '13 #1
1 2411
miller
1,089 Recognized Expert Top Contributor
You're indicating the content time image/gif, but the content you're actually outputting is text/html. If you actually want to send an image, then you must send the contents of that image out after the header:

Expand|Select|Wrap|Line Numbers
  1. use File::Copy;
  2. print "Content-type: image/gif\n\n";
  3. copy "/path/to/image.gif", \*STDOUT;
  4.  
- Miller
Dec 9 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
4444
by: harshan | last post by:
Hi I am trying to read required worksheet from excel file using perl with module spreadsheet::parseexcel and spreadsheet::writeexcel but I am unable to read it, the error I am getting is subroutine &main::worksheet not found. any help regarding this will be greatly appriciated. Harshan
3
2274
by: Mandy Holmes | last post by:
Hi all (Newbie alert!) I am a bit stuck. I want to set a cookie when a hyperlink on my website is clicked. This cookie will then be used to determing which of 5 images is displayed on that page and all the subsequent pages throughout the website. I don't know of the best way to do this as I am merely a graphic designer taking on a new challenge! If anyone has any suggestions it would be greatly appreciated.
3
5233
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from database and display it in a Image web control dynamically(at runtime). The process after being displayed in the web control, user click insert/add button, it converts the image(jpeg) file to bytes and store it the database with Image or VarBinary...
1
1575
by: lalithabhamidi | last post by:
I am trying to display an image using MagickimageDisplay using C API. But it asks for X server.So i am unable to display my image. Any Suggestions??
0
969
by: shabana | last post by:
hi, i wrote a code to display image from a file using adsp imageviewer, Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click AxADspImageViewer1.SourceLocation = IMAGEPLUGINLib.adspImageSourceLocation.sourceLocationFile AxADspImageViewer1.PixelFormat = IMAGEPLUGINLib.adspImagePixelFormat.pixelYuy2
4
19680
by: jram01 | last post by:
Hi Folks, I am facing problem to to execute .sql command in sql prompt using perl script. I am able to connect sql promt using " my $odbcinput = "odbcinput.txt"; my $odbcoutput = "odbcoutput.txt"; open (ODBCSQLFH, ">$odbcinput") || die "Unable to create input file ($odbcinput) for odbcsql\n";
1
1515
by: nehaz | last post by:
can anyone tell me how can i configure a device from HTTP page using perl ? I am using following cmd to enter the http page use HTTP::Request; $req = HTTP::Request->new($httpRequestMethod => "http://192.168.1.1/"); sleep 10; $req->authorization_basic("admin","password"); sleep 10; How can i change values on that page ? will print statement work or is there any other way to do that ?
2
15978
by: Coreyja | last post by:
Im trying to display a png image by setting it as a ImageIcon and then putting that in a JLabel. I cant get it to display the image. I am using a null layout as it is the simplest way for me to get everything displayed how I want it to be. Here are the snippets of my code that I think are the important parts. Let me know if there is anything else needed to help me. Thanks in advance. JLabel dice1 = new JLabel(); ImageIcon one = new...
2
6055
by: santhanalakshmi | last post by:
Hi, I am running Apache and the Active Perl. In Apache, CGI folder, i had one JPEG image. I wants to display this JPEG image in my browser as the header. use CGI qw(:all); print "Content-type: text/html\n\n"; print "<body bgcolor="FFFF">; print "<img src=\cgi-bin\header.jpg>"; print "</body>;
2
1792
by: osm3000 | last post by:
Hi All, I'm using trying to make a script to send email using perl. I found this in http://bytes.com/topic/perl/answers/855265-perl-send-email I found this one, however it doesn't work. ////////////////////////////////////////////
0
8418
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8940
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8840
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6249
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5718
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4237
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4433
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2083
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1831
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.