Gossamer Forum
Home : Products : DBMan : Customization :

error showing X when the grafic does not exist

Quote Reply
error showing X when the grafic does not exist
     

Hello,

The odd thing found in the db after the search result is showing X

in the search result page. X means small box with x mark which signs

broken grafic link. Could anyone tell me how to bring search result without x Mark eventhugh file does not exist? Below is the copy of the code.



my (%rec) = @_; # Load any defaults to put in the VALUE field.
$rec{$db_key} =~ s/<.?B>//g;
if (-e "$SAVE_DIRECTORY/$rec{$db_key}/$file") {
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);
}
}



<td rowspan="3"><img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[0]"> </td>
Quote Reply
Re: [tilmes] error showing X when the grafic does not exist In reply to
Try this:

if (@photo) { # if image files were found

foreach my $photo (@photo) { # print all image files

print qq|<tr><td><img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo"> </td></tr>|;

# replace the tr/td with table code of your preference

}

}
kellner
Quote Reply
Re: [kellner] error showing X when the grafic does not exist In reply to
Hello kellner,

thanks for your email and glad to hear you again.

With a change you brought to, How put a graphic into a cell?

The graphic must stay in this cell.

<td rowspan="3"><img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[0]"> </td>

Or can be still used table code of your preference to make a tabel that i thougt of?


Below is the table i think of;

print qq|<TABLE WIDTH="475" BORDER="1" CELLPADDING="0" CELLSPACING="0" BGCOLOR="#FFFFCC">
<tr>
<td rowspan="3"><img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[0]"> </td>
<td rowspan="2">&nbsp;<$font>$rec{'company'}</Font></td>
<td><$font>$rec{'Date'}</Font></td>
</tr>
<tr>

<td>&nbsp;<$font>$rec{'Tel'}</Font></td>
</tr>
<tr>
<td colspan="2">&nbsp;<$font>$rec{'tdi'}</Font></td>
</tr> </TABLE>|;

Last edited by:

tilmes: Mar 4, 2002, 12:05 PM
Quote Reply
Re: [tilmes] error showing X when the grafic does not exist In reply to
From your code, I gather that there might be more than one image associated with a record.

If you want all images to print in one table cell and align them vertically, you could do this:

print qq|<td rowspan="3">|;

if (@photo) { # if image files were found

foreach my $photo (@photo) { # print all image files

print qq|<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo"><br>|;
}


print qq|</td>|;
kellner
Quote Reply
Re: [kellner] error showing X when the grafic does not exist In reply to
    

Hello Kellner,

appreciate that took some time for this change.

Yes i started from the thread display;#149869

to put a Graphic into the cell not intend to

display more than one pictures in search results.

That is why messed a little bit the code.

With your tip removed ultimately X from the search results

and now see either with picture or only the text.

: )

Last edited by:

tilmes: Mar 4, 2002, 1:39 PM
Quote Reply
Re: [tilmes] error showing X when the grafic does not exist In reply to
Do you mean there is still a problem or not? What do you mean by saying "only text"?

Your code checks all graphic files in the directory /$SAVE_DIRECTORY/$rec{$db_key} and stores them in the array @photo. In other words, @photo contains a list of all found graphic files. The code I suggested then checks whether such a list exists - i.e. if graphic files were found in the directory -, and, if so, prints them all with a "<br>" in between.
kellner
Quote Reply
Re: [kellner] error showing X when the grafic does not exist In reply to
Hello Kellnner,

I am sorrry not clearly answered,

when the graphic is found in directory it print out.

It works exactly as described.

: )
Quote Reply
Re: [tilmes] error showing X when the grafic does not exist In reply to
Ok, then. Great!
kellner