Sponsored Content
Top Forums Shell Programming and Scripting cgi script to print all .png files on a single page Post 302427321 by jeffersno1 on Friday 4th of June 2010 03:35:18 PM
Old 06-04-2010
cgi script to print all .png files on a single page

Hi guys

I'm relativley new to Perl, and have not touched html before, im trying to write a cgi script that prints all images on a single html page from a given directory. Im using perl to gather stats, rrdtool to update and create graphs now i just need to print these graphs all onto 1 index.cgi page.

The page appears but no images

I need to do it dynamically as new graphs will appear in the future, otherwise i could just add them 1 by 1.

Heres the code i have so far, can anyone suggest if and what im doing wrong here?

Code:
#!/usr/bin/perl -w

use strict;
use CGI;

my $cgi = new CGI;
my $image = $cgi->param('image');

print "Content-type: text/html\n\n";

print "<html><head><title>$image</title></head>\n";
print "<body>\n";
print "<center>\n";
print "<img src=/var/www/html/$image><p>\n";
print "</center>\n";
print "</body>\n";
print "</html>\n";

Thanks very much
Jeffers
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

CGI passing arrays/hashes to another CGI script

If I have a Perl CGI script (script01), which fills an array(s) with information and outputs a HTML page with a link to another CGI page (script02); is there anyway to pass the array(s) from "script01" to "script02" when the page visitor clicks the link? Hope that makes sense! :) (2 Replies)
Discussion started by: WIntellect
2 Replies

2. Shell Programming and Scripting

CGI: refresh page and timeout

Hi, I've been able to put together an HTML page that calls on a cgi program (via ksh) to do some server side processing, then send it back to the user's browser window. The script basically tails a log file and refreshes every # seconds (user chosen) by using the "refresh" meta tag (html). My... (0 Replies)
Discussion started by: man
0 Replies

3. Shell Programming and Scripting

lpr- how to print from page to page

hi all i have file_1 which contains 66 pages and i want to print only page 1 to 3 i try to write like this lp -d name_of_printer file_1 -P 1-7 this command does not work any ideas ? (4 Replies)
Discussion started by: naamas03
4 Replies

4. Shell Programming and Scripting

How to pass data from server (CGI script) to client (html page)

Hi I know how to pass data from client side (html file) to server using CGI script (POST method). I also know how to re-create the html page from server side after receiving the data (using printf). However I want to write static pages on client side (only the structure), and only to pass... (0 Replies)
Discussion started by: naamabm
0 Replies

5. Shell Programming and Scripting

Delete Files with CGI Bash Script

Hi. I could use some help with my problem. I am creating a website. One option on this website is to delete a specified file, say an image, when the user clicks on it. I want to do this with CGI. I believe bash will be the easiest since I will just type the command "rm file". I also do not know... (4 Replies)
Discussion started by: JMooney5115
4 Replies

6. Shell Programming and Scripting

Print multiple copies page by page using lp command

Hi I have a pdf file that is being generated using the rwrun command in the shell script. I then have the lp command in the shell script to print the same pdf file. Suppose there are 4 pages in the pdf file , I need to print 2 copies of the first page, 2 copies of the second page , then 2... (7 Replies)
Discussion started by: megha2525
7 Replies

7. Web Development

CGI not working with httpd server on busybox 1.15.0 on ltib Linux 2.6.34 (404 page not found)

I have some industrial ARM linux board with 2.6.34 Linux on it with Busybox v1.15.0. The https.conf is located in /etc/ and contains: H:/root/web In the www directory I also have 'cgi-bin' folder with chmod 777 and in that folder a file called 'testcgi'. Now I start the server with... (1 Reply)
Discussion started by: Roboserg
1 Replies

8. Windows & DOS: Issues & Discussions

Super Simple Script to remove first characters of any png file

Well I searched the net with varying success, but it seems kinda hard to find a one/max 2 lined command to: strip all *.png files in the folder from their first two characters. Any help is appreciated. In DOS commandline of course... (17 Replies)
Discussion started by: pasc
17 Replies

9. Shell Programming and Scripting

Perl CGI : unable to download the excel sheet from perl cgi page

Hi All, I have written an cgi perl script that displays an image(Excel image) and when clicked on that Image I need to download a excel sheet. I made sure that excel sheet exists in the folder with the given name but still I am not able to download the sheet. print "<center><table... (2 Replies)
Discussion started by: scriptscript
2 Replies
HOBBITGRAPH.CGI(1)					      General Commands Manual						HOBBITGRAPH.CGI(1)

NAME
hobbitgraph.cgi - CGI to generate Xymon trend graphs SYNOPSIS
hobbitgraph [options] DESCRIPTION
hobbitgraph.cgi is invoked as a CGI script via the hobbitgraph.sh CGI wrapper. hobbitgraph.cgi is passed a QUERY_STRING environment variable with the following parameters: host Name of the host to generate a graph for service Name of the service to generate a graph for disp Display-name of the host, used on the generated graphs instead of hostname. graph Can be "hourly", "daily", "weekly" or "monthly" to select the time period that the graph covers. first Used to split multi-graphs into multiple graphs. This causes hobbitgraph.cgi to generate only the graphs starting with the "first'th" graph and continuing for "count". count Number of graphs in a multi-graph. upper Set the upper limit of the graph. See rrdgraph(1) for a description of the "-u" option. lower Set the lower limit of the graph. See rrdgraph(1) for a description of the "-l" option. graph_start Set the starttime of the graph. This is used in zoom-mode. graph_end Set the end-time of the graph. This is used in zoom-mode. action=menu Generate an HTML page with links to 4 graphs, representing the hourly, weekly, monthly and yearly graphs. Doesn't actually gen- erate any graphs, only the HTML that links to the graphs. action=selzoom Generate an HTML page with link to single graph, and with JavaScript code that lets the user select part of the graph for a zoom-operation. The JavaScript invokes hobbitgraph.cgi with "action=showzoom" to generate the zoomed graph webpage. action=showzoom Generate HTML with a link to the zoomed graph image. This link goes to an "action=view" invocation of hobbitgraph.cgi. action=view Generate a single graph image. OPTIONS
--config=FILENAME Loads the graph configuration file from FILENAME. If not specified, the file $BBHOME/etc/hobbitgraph.cfg is used. See the hobbit- graph.cfg(5) for details about this file. --env=FILENAME Loads the environment settings defined in FILENAME before executing the CGI. --rrddir=DIRECTORY The top-level directory for the RRD files. If not specified, the directory given by the BBRRDS environment is used. --save=FILENAME Instead of returning the image via the CGI interface (i.e. on stdout), save the generated image to FILENAME. --debug Enable debugging output. ENVIRONMENT
QUERY_STRING Provided by the webserver CGI interface, this decides what graph to generate. FILES
hobbitgraph.cfg: The configuration file determining how graphs are generated from RRD files. SEE ALSO
hobbitgraph.cfg(5), xymon(7), rrdtool(1) Xymon Version 4.2.3: 4 Feb 2009 HOBBITGRAPH.CGI(1)
All times are GMT -4. The time now is 01:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy