Gossamer Forum
Home : Products : DBMan : Customization :

Display Image-Not-Available problems in IMAGE MOD

Quote Reply
Display Image-Not-Available problems in IMAGE MOD
Hi, Wink

I am having problems displaying "Image-Not-Available" image, when record is listed with "Show All records" from the menu.

There is no image loaded there at all..( like the code part -unless- has no effect )

But, when a new object is added to a database, and confirmation page is displayed with information that has been added, there is an "Image-Not-Available" Image, displayed. So why is it working here and not at the Show/List All Records page ?

This is the code used i html.pl file:

<td>

|; # to close off a previous print qq| statement
opendir (GRAPHIC, "$SAVE_DIRECTORY") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORY. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
$file_test = $rec{$db_key} . ".";
foreach $file (@files) {
if ($file =~ /^$file_test/) {
print qq|<img src= "$SAVE_DIRECTORY_URL/$file" border=1 width=160 height=120>|;
$graphic_found=1;
}
}


unless ($graphic_found) {
print qq|<img src="$SAVE_DIRECTORY_URL/unavailable.gif">|;
}
print qq|

</td>


Thank You In Advance!

Regards,

[vildan]

Last edited by:

vildan: Jan 17, 2002, 6:02 AM
Quote Reply
Re: [vildan] Display Image-Not-Available problems in IMAGE MOD In reply to
Im not 100% sure whether this will solve it but it is part of the problem...the code in the mod isn't correct and no-one seems to want to fix it Frown:

if ($file =~ /^$file_test/) {

...try....

if ($file =~ /^\Q$file_test\E/) {

Last edited by:

RedRum: Jan 17, 2002, 6:50 AM
Quote Reply
Re: [vildan] Display Image-Not-Available problems in IMAGE MOD In reply to
Hi Vildan,

Let try the scripts bellow:
....
foreach $file (@files) {
next if ($file eq '.');
next if ($file eq '..');
my ($name) = $file =~ /([^.]+)/;

if ($name eq $rec{$db_key}) {
print qq|<img src= "$SAVE_DIRECTORY_URL/$file" border=1 width=160 height=120>|;
$graphic_found=1;
last;
}
}

.....

TheStone.

B.
Quote Reply
Re: [TheStone] Display Image-Not-Available problems in IMAGE MOD In reply to
You could chop out those two "next" lines by using grep earlier...

opendir ...
@files = grep { !/^\.+/ } readdir(GRAPHIC);
closedir ...
Quote Reply
Re: [RedRum] Display Image-Not-Available problems in IMAGE MOD In reply to
Hi,Smile

Thank you on your reply.

Is there anybody who can modify the IMAGE MOD so this work and people downloading this
doesn't have to experience the same problems over and over again?

I have browsed around the forum and found hundreds of same issues to this question.

Regards,


Thank You In Advance!

Regards,

[vildan]
Quote Reply
Re: [[morpheous]] Display Image-Not-Available problems in IMAGE MOD In reply to
Updates and fixes to the various mods are available in the FAQ noted below.

The mods were written awhile ago and the author of the mods is no longer available to make updates to each mod. Several changes were made a few months back.

It's a good idea to check the FAQ for threads relating to the mods you choose to use and also the forum.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] ] Display Image-Not-Available problems in IMAGE MOD In reply to
Hi,

I have modified code below to successfully open images from database, but I still have problems with "List All" function.

When I choose "View" and type the ID of the record, and pull the record without the image on the record than my 'notavailable' image is displayed. But when I choose List All then there is nothing displayed in the record without image on the record.

I have made several changes so far, but non is working. Below is output of the fragment of the html.pl file sub html_record { :

Code:
opendir (GRAPHIC, "$SAVE_DIRECTORY") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORY. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
$file_test = $rec{$db_key};
foreach $file (@files) {
if ($file =~ /^\Q$file_test.\E/) {
print qq|<img src= "$SAVE_DIRECTORY_URL/$file" Border="1" Width="160" Height="120">|;
$graphic_found=1;
}
}

unless ($graphic_found) {
print qq|<img src="$SAVE_DIRECTORY_URL/loading.gif" Border="1" Width="160" Height="120">|;
}


I have also checked for updates on the FAQ but there is nothing that is mentioning my problem or solution to it.


Thank You In Advance!

Regards,

[vildan]
Quote Reply
Re: [vildan] ] Display Image-Not-Available problems in IMAGE MOD In reply to
In the code segment you've provided, try changing this:

unless ($graphic_found) {

to be:

unless ($graphic_found=1) {
Quote Reply
Re: [Karen] ] Display Image-Not-Available problems in IMAGE MOD In reply to
>>unless ($graphic_found=1) { <<

You mean:

unless ($graphic_found == 1) {

...however it makes no difference.

unless ($graphic_found) {

and

unless ($graphic_found == 1) {

do the same in this case.

Last edited by:

RedRum: Jan 20, 2002, 2:18 PM
Quote Reply
Re: [RedRum/Karen] Display Image-Not-Available problems in IMAGE MOD In reply to
Hi,


I have tried both methods long ago (that was my first try), but it's not working...

Note: If I view only one object 'not-available-image' is visible, but if I show all records, it is not.


Thank You In Advance!

Regards,

[vildan]

Last edited by:

vildan: Jan 20, 2002, 3:05 PM
Quote Reply
Re: [vildan] Display Image-Not-Available problems in IMAGE MOD In reply to
Hi Vildan, I'm not sure what the problem is yu're having or where it originates. It is difficult trying to second guess a problem when not viewing the files. If you could save your file as a text file and upload to your server so it can be viewed via the web, I'd be happy to take a look at it. ~ I don't like doing the file attachment thing in here because I'm forced to save the file myself in order to view it. ~



The change I was suggesting would have been in this portion of the code:

unless ($graphic_found=1) {
print qq|<img src="$SAVE_DIRECTORY_URL/loading.gif" Border="1" Width="160" Height="120">|;
}



~ Karen