473,320 Members | 2,020 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,320 software developers and data experts.

need simple cgi to select image dynamically

GU
Is it possible to use an simple cgi script to select one graphic
dynamically and use this one as background image?

if using
<body background="/httpdocs/pics/test.jpg"> blah </body>
i'll get this backgroung picture.

but i want to get the backgroungimage dynamically. so i'd like to use
an simple cgi script
<body background="/cgi-bin/test.pl"> blah </body>
but this does not work.

the script is like this:
#!/usr/bin/sh
file="/httpdocs/pics/test.jpg"
cat $file

Of course i may use perl/GD or jpgraph to do this, but i want to know
if there is a way to do this with a script.

thanks
gerhard

May 30 '06 #1
5 2101
GU
GU wrote:
<body background="/cgi-bin/test.pl"> blah </body>

sorry ... must be
<body background="/cgi-bin/test.sh"> blah </body>

May 30 '06 #2
On Tue, 30 May 2006 15:09:28 +0200, GU <ge************@yahoo.de> wrote:
but i want to get the backgroungimage dynamically. so i'd like to use
an simple cgi script
<body background="/cgi-bin/test.pl"> blah </body>
but this does not work.

the script is like this:
#!/usr/bin/sh
file="/httpdocs/pics/test.jpg"
cat $file


Something like that might work, but you have to make the script send out
the correct headers first:

#!/usr/bin/sh
echo"Content-Type:image/jpeg\n\n"
file="/httpdocs/pics/test.jpg"
cat $file

(I don't know if this is a correct sh script, but you get the gist.)
--
Garmt de Vries
May 30 '06 #3
GU
that was also my choise.

If using the Script
#!/bin/sh
echo "Content-type: text/html";
echo
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'
echo "<html><head><title>my pages</title>"
echo "</head><body>"
find ../httpdocs | sed 's/$/<br>/'
echo "</body></html>"

everything seems to be OK.
But if choosing any other Content-type else i will be asked for the
program to open "sh-files". (firefox and IE will do the same)

May 30 '06 #4
Gazing into my crystal ball I observed "GU" <ge************@yahoo.de>
writing in news:11**********************@i40g2000cwc.googlegr oups.com:
Is it possible to use an simple cgi script to select one graphic
dynamically and use this one as background image?

if using
<body background="/httpdocs/pics/test.jpg"> blah </body>
i'll get this backgroung picture.

but i want to get the backgroungimage dynamically. so i'd like to use
an simple cgi script
<body background="/cgi-bin/test.pl"> blah </body>
but this does not work.

the script is like this:
#!/usr/bin/sh
file="/httpdocs/pics/test.jpg"
cat $file

Of course i may use perl/GD or jpgraph to do this, but i want to know
if there is a way to do this with a script.

thanks
gerhard


I would use CSS instead, you can programatically create CSS as long as
you serve the right content type. Then you can link to that external
stylesheet, eg: <link type="text/css" rel="stylesheet"
href="dynamicstyle.asp">

Maybe dynamicstyle looks something like:

<% option explicit
Response.ContentType = "text/css" %>
<% dim backgroundimage, backgroundcolor, bodycolor

if datepart("m",date()) = 12 and datepart("d",date()) = 25 then
backgroundimage = "evergreen.gif"
backgroundcolor = "#228b22"
bodycolor = "#fff"
elseif datepart("m",date()) = 2 and datepart("d",date()) = 14 then
backgroundimage = "hearts.gif"
backgroundcolor = "#ff0"
bodycolor = "#fff"
else
backgroundimage = "regular.gif"
backgroundcolor = "#fff"
bodycolor = "#000"
end if

%>
body {color:<%=bodycolor%>;
background-color:<%=backgroundcolor%>;
background-image:<%=backgroundimage%>}
}

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Jun 1 '06 #5
GU
Adrienne Boswell schrieb:

I would use CSS instead, you can programatically create CSS as long as
you serve the right content type. Then you can link to that external
stylesheet, eg: <link type="text/css" rel="stylesheet"
href="dynamicstyle.asp">

thanks, that's a good idea.

Jun 4 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: LRW | last post by:
Having a problem getting a onSubmit function to work, to where it popsup a confirmation depending on which radiobutton is selected. Here's what I have: function checkdel() { if...
23
by: Adam | last post by:
I am coding a microkernel based off of Tanebaum's theroy. For Isis to be extensible, fast, and secure, it has been decided it will be a microkernel. Not in the old Mach sense of the word, but in...
3
by: Jheitmuller | last post by:
Hi, I would like to convert a VB.NET application from being a Windows app to an ASP.NET app. I'm new to web development, so this may be a simple question. Is it possible to render simple drawing...
2
by: Ken Varn | last post by:
I have a control that I developed that uses a custom HTTPModule to dynamically render images to a web page using ASP.NET. It works most of the time with one exception. For some reason, Internet...
4
by: DjShifta | last post by:
Ok this really shouldn't be that hard...but I can not figure out whats' wrong for the life of me. I am brand new to "coding" and have thus far just built basic sites with Dreamweaver, but am going...
7
by: Dave | last post by:
Hello All, These one may be a bit tricky, and what I'd like to do may not even be possible. I would love to hear any ideas you guys have for solving this. Here is the situation: I have a form...
13
by: Effix | last post by:
Hi everybody I have yet another problem, actually two but lets start with this one :-) Im making a very simple gallery or at least I think its simple. I have already made a upload script that...
1
joedeene
by: joedeene | last post by:
Hello all, I am using Macromedia Flash Professional 8 in this example of a simple way to use motion tweens. Ok here goes... Directions: A. Preparation 1.) Start the Flash program. Once...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.