Gossamer Forum
Home : Products : DBMan : Installation :

Add a graphic mod

Quote Reply
Add a graphic mod
UnsureI added a mod from JPDeni that allows one graphic to be uploaded with a single record. All is well except that when I click on "list all" the default graphic that I uploaded doesn't show up, yet it shows up whenever you add a record without designating a graphic to be uploaded, modify a record and you haven't uploaded a graphic and it also shows up when you search for a "specific" record.

I assume the script doesn't show the default on the "list all" link so you don't have to wait for 20 or 30 default graphics to be rendered when the results don't have associated graphics, is this a correct assumption????
Quote Reply
Re: [htmlsitedesign] Add a graphic mod In reply to
No, the assumption isn't accurate - the image, uploaded or default should be displayed whether viewing the single record or list all unless you are using the Short/Long display and have not defined an area for the image in the short display.

If the problem is something else, you'd need to save your html.pl file as a text file and upload to your server where it can be viewed via the web. Post again providing the URL where the file can be viewed.

~ Karen
Quote Reply
Re: [Karen] Add a graphic mod In reply to
html.pl is here:
http://htmlsitedesign.com/a/html.txt

hope you find my error, I've looked at it so long, all I see is blurry text Smile
Quote Reply
Re: [htmlsitedesign] Add a graphic mod In reply to
 
You are not requiring people to add a graphic but I don't see the field "Graphic" defined in your add_record_form

You might also want to make the following changes:

replace:

$file_test = $in{$db_key} . ".";

with:

$file_test = $rec{$db_key};

replace:

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

with:

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

Read through the instructions again and be sure you have everything needed if you do NOT require an image to be uploaded.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [htmlsitedesign] Add a graphic mod In reply to
The only additional thing I notice, other than Lois's feedback, is a blank space in this line:

<!--StartFragment-->print qq|<img src= "$SAVE_DIRECTORY_URL/$file">|;

Try removing that blank space following the = symbol.
Quote Reply
Re: [LoisC] Add a graphic mod In reply to
When you say add_record_form, do you mean the html_record_form?? The table field is added if db_upload is valid and authorized. Or do you mean the html_add_form??

But I did try all of your suggestions and I removed the space like Karen said too, but the darn graphic still isn't showing, weird huh? Yet, it still works OK except for this minor flaw.

I thought maybe that my cgi zones were set wrong but checked and the cgi can read and write to the correct directory to save and retrieve the graphic.

When I first set this mod up I put the code to show the graphic in the wrong place and it showed up then on a "list all" but the graphic was outside of the table and sometimes made a double display. But, when the code was put in the proper position to show the graphic in the table data cell, it now doesn't show.

Is there any other file that I would let you see that would help??

Puzzled!, yet still happy with the database performance...
Quote Reply
Re: [htmlsitedesign] Add a graphic mod In reply to
I honestly haven't the slightest idea whether this will work so be sure to save a copy of your html.pl file before making the change. Let's try a if/else statement instead of an if/unless statement.

Try changing this:

|; # 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">|;
$graphic_found=1;

}
}

unless ($graphic_found) {
print qq|<img src="http://htmlsitedesign.com/pics/dbpic/alert.gif">|;
}

print qq|</TD></TR>



TO:



|; # 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">|;
$graphic_found=1;

}
else {
print qq|<img src="http://htmlsitedesign.com/pics/dbpic/alert.gif">|;
}
}


print qq|</TD></TR>


Hope this will work for you!

~ Karen