CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Trying to use image as a link? Help please

 



allan__clark
Deleted

Apr 30, 2000, 6:47 AM

Post #1 of 5 (1318 views)
Trying to use image as a link? Help please Can't Post

I have perl code for a search engine that returns some text in addition to an image. I would like to use this image to link to another page as well as passing any of the fields in this record. I hope this makes sense?

Presently I am using the thumbnail as a link to the larger image.
http://www.peiwebdirectory.com/aesearch.cgi

if ($field[10] ne "")
{$image="<a href=\"http\:\/\/peiwebdirectory\.com\/image\/$field[9]\"><img src=\"../image/$field[10]\" border=\"1\" alt=\"Click to Enlarge\"></a>";}


Rivotti
User

Apr 30, 2000, 4:25 PM

Post #2 of 5 (1318 views)
Re: Trying to use image as a link? Help please [In reply to] Can't Post

Hi allan_clark:

try this:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

{ $image='<a href="http://peiwebdirectory.com/image/$field[9]"><img border="1" src=""../image/$field[10]" alt="Click to Enlarge"</a>'; }</pre><HR></BLOCKQUOTE>

I use ' instead of " because these way I dont need to use / before any special characters. To parse some kind of data using a link, for example Text1="text", to anhoter program ( Ex: exp.cgi ):

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

http://www.server.com/cgi-bin/exp.cgi?Text1="text"</pre><HR></BLOCKQUOTE>

Hope this helps
Rivotti



allan__clark
Deleted

Apr 30, 2000, 5:17 PM

Post #3 of 5 (1318 views)
Re: Trying to use image as a link? Help please [In reply to] Can't Post

Sorry about that........like I said I likely didn't do a good job explaining myself. On top of that, the link I provided was the wrong URL.

The correct URL is http://www.peiwebdirectory.com/cgi-bin/aedisplay.cgi

If you look at the site, which is quick loading, you may get a better understanding of what I'm trying to explain. The code that you provide....thanks.... does the same thing as mine, a little neater but the same.

What I want to do is use the button to go to another page, while passing the information from only that record with it. I hope this clarifies what I'm trying to accomplish.

Thanks
Allan


darian
Deleted

May 1, 2000, 1:48 AM

Post #4 of 5 (1318 views)
Re: Trying to use image as a link? Help please [In reply to] Can't Post

Ok if I get you right you want to be able to click on the image and be taken to a full version of that image as well as have the information about the picture displayed as well right? If this is correct try this:
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

if ($field[10] ne "")
{$image='<a href="http://www.yoursite.com/cgi-bin/view.cgi?id=$artID"><img src="http://www.yoursite.com/images/$field[10]" border=\"1\" alt=\"Click to Enlarge"></a>';}</pre><HR></BLOCKQUOTE>

Now you can write a small script to look this ID out and display it.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

$inID = $in->param{'artID'};
open(DB, "image.db") or die;
while (<DB> ) {
($artID, $image, $desc) = split /\|/;
if($artID =~ /$inID/) {
print "<img src=$image>\n<br>\n";
print "Art ID: $artID\n<br>\n";
print "Description: $desc<br>\n";
}
}
close(DB);</pre><HR></BLOCKQUOTE>

This will allow you to just do a simple lookup and you can have the images shown at the correct size and have the image info displayed as well. Hope this helps.



allan__clark
Deleted

May 2, 2000, 2:49 AM

Post #5 of 5 (1318 views)
Re: Trying to use image as a link? Help please [In reply to] Can't Post

Thanks e everyone,

Working great

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives