close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Thumbnail and if file_exists : View cart

Thread began 5/17/2010 4:07 pm by MikeH | Last modified 5/17/2010 7:06 pm by MikeH | 685 views | 3 replies |

MikeH

Thumbnail and if file_exists : View cart

Hi
Is there a way in the View_Cart if a thumbnail doesnt exist a genericimage is shown?

The code I am trying to use is:

<?php
if (file_exists($eCart1->DisplayInfo("Thumbnail"))) {
?>

<img src="<?php echo $eCart1->DisplayInfo("Thumbnail"); ?>" alt="" width="95" class="eC_ProductThumb" />

<?php
} else { ?>
<img src="images/noimage.png" alt="" width="95" " class="eC_ProductThumb" />
<?php
}
?>

---------------
As Im am testing this $eCart1->DisplayInfo("Thumbnail") it fails the test everytime any way around this?

It is purely that refrence that is failing as used outside of ecart with a normal recordset refrence this code works.

Any ideas?

Thanks

Mike

Sign in to reply to this post

tom92909Beta Tester

You could add a logical field to your products table that indicates if the thumbnail exists and same for a large images too. Storing a zero for NO & a one for YES in your indicator field. You could probably make that default to NO, and update to YES when a successful upload is completed for each record.

php:
<?php
   
if ($row_getProduct['thumbnail_exist']==0) {
   
?>
   <img  src="images/default_thumb.jpg" width="95" border="0">
   <?php
   
} else {
   
?>
   <img  src="images/<?php echo $row_getProduct['thumbnail']; ?>" width="95" border="0">
 <?php      
   
}
 
?>
Sign in to reply to this post

MikeH

Hi
Thanks for the reply. Thats basically what |I have done on the rest of the site. Its just in the actual "Display Cart" section you get the binding

$eCart1->DisplayInfo("Thumbnail")

which contains for example - ../images/thumbs/yourtumb.jpg

Problem is

if (file_exists ............

Does not seem able to use that binding it always fails the test.

I want to cover all bases and actaully check if the file exists not just the name in the DB just in case the physical file is not there.

Mike

Sign in to reply to this post

MikeH

Hi
Sorted it. Chenged my code to this and that now does check if a physical file exists.

php:
<?php

                                        
                
if (file_exists($_SERVER{'DOCUMENT_ROOT'} . "uploaded_images/thumbs/"  $eCart1->DisplayInfo("Thumbnail"))) {
                
?>
                
                <img  src="../uploaded_images/thumbs/<?php echo $eCart1->DisplayInfo("Thumbnail"); ?>" alt="" width="95" class="eC_ProductThumb" />
                
                                            <?php
            
} else { ?>
            <img  src="images/noimage.png" alt="" width="95"  " class="eC_ProductThumb" />
<?php            
            
}
            
?>



Thanks for your help.

Mike

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...