473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Unable to display image using perl CGI

3
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 2401
miller
1,089 Expert 1GB
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
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...
3
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...
3
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...
1
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
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 ...
4
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...
1
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 =>...
2
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...
2
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...
2
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.