Gang,
I have searched but couldn't find the answer. I have succesfully followed other posts to allow me to place each image in a specific place on the resulting page. However, if a record does not have all images (record only contains 2 or 3 of 5 possible images) I get the broken image icon on the page for each missing image. Can someone tell me the proper if-else format to ignore images? Thanks.
My code currently looks like this:
|;
if (-e "$SAVE_DIRECTORY/$rec{$db_key}") {
opendir (GRAPHIC, "$SAVE_DIRECTORY/$rec{$db_key}") or &cgierr("unable to open directory: $SAVE_DIRECTORY/$rec{$db_key}. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
@photo = qw();
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
push(@photo, $file);
}
}
print qq|<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[0]"><br>
<a href="http://www.emsbooks.com/Merchant2/agent.mv?AG=InforMed&SC=BASK&S=EOB&A=ADPR&Q=1&P=$rec{'Books_ID'}"><img src="graphics/order-online.jpg" width="80" height="20" border="0" alt="Order online through a cooperative partnership with EMSBooks.com"></a><br>
<br>
<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[1]"><br>
<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[2]"><br>
<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[3]"><br>
<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[4]"><br>
</td>
I want to be sure that $photo[1-4] do not show broken image icons on teh page if the record does not contain more than $photo[0].
Thanks.
Richard Bilger
RBilger@MERGINET.com
MERGINET.com: Emergency Responders Web Site
http://www.merginet.com
I have searched but couldn't find the answer. I have succesfully followed other posts to allow me to place each image in a specific place on the resulting page. However, if a record does not have all images (record only contains 2 or 3 of 5 possible images) I get the broken image icon on the page for each missing image. Can someone tell me the proper if-else format to ignore images? Thanks.
My code currently looks like this:
|;
if (-e "$SAVE_DIRECTORY/$rec{$db_key}") {
opendir (GRAPHIC, "$SAVE_DIRECTORY/$rec{$db_key}") or &cgierr("unable to open directory: $SAVE_DIRECTORY/$rec{$db_key}. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
@photo = qw();
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
push(@photo, $file);
}
}
print qq|<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[0]"><br>
<a href="http://www.emsbooks.com/Merchant2/agent.mv?AG=InforMed&SC=BASK&S=EOB&A=ADPR&Q=1&P=$rec{'Books_ID'}"><img src="graphics/order-online.jpg" width="80" height="20" border="0" alt="Order online through a cooperative partnership with EMSBooks.com"></a><br>
<br>
<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[1]"><br>
<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[2]"><br>
<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[3]"><br>
<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[4]"><br>
</td>
I want to be sure that $photo[1-4] do not show broken image icons on teh page if the record does not contain more than $photo[0].
Thanks.
Richard Bilger
RBilger@MERGINET.com
MERGINET.com: Emergency Responders Web Site
http://www.merginet.com