473,769 Members | 1,994 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2129
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><t itle>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.goo glegroups.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="dynamicst yle.asp">

Maybe dynamicstyle looks something like:

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

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

%>
body {color:<%=bodyc olor%>;
background-color:<%=backgr oundcolor%>;
background-image:<%=backgr oundimage%>}
}

--
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="dynamicst yle.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
2366
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 (document.getElementById"].value=='1') { confirm('Are you sure you want to delete this file?'); } } ......
23
2602
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 the size of the entire project. It is a microkernel, that will limit interprocess communication. But as Tanenbaum says, you learn nothing by reading theroy alone. The code should be self-explaintory. Another reason I choose the microkernel method...
3
1677
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 commands in an ASP.NET application? Something line draw a line point to point, or draw a circle at this point. If so, can somebody point me toward the library or technique to use? I can figure it out if I can get pointed in the right...
2
1535
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 Explorer does not always display the images even though the image has been sent successfully. I sometimes have to right click on the image and select "Show Image" and then the image appears. This is totally random. I can refresh the screen and...
4
1457
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 through my CIW certs, and this is an exercise i am feeling a little "dumb'' on.... any help.... Question exactly as it's worded: Create a Web page that contains an HTML form, a list box, a button and an <img> tag. Populate the list box with at...
7
3323
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 that displays the high-level data for a set of records in continuous forms mode. I have a simple command button that will open another form with the details of the selected record.
13
1339
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 uploads and resizes the image and also creates a thumbnail. So now I have my folder "images/galleri/" and "images/galleri/thumbs". Now its time to dynamically display the images on a page. I have set the $filename variable to display the thumbnails...
1
7438
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 loaded, create a new Flash Document. Note: By default the pixels are set to 550 x 400, i changed mine to 275 x 200. 2.) Speed up the animation by changing the frame rate to 36 fps.
0
10205
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
10035
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...
0
8863
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7401
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
5293
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
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
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.