thetechieone Posted May 17, 2010 Share Posted May 17, 2010 I have a wordpress site that I am working on and I have a plugin that allows the user to upload a picture to a business directory. http://www.bccsf.org/diretorio-de-servicos/. I am trying to tweak the code to show a default image if an image is not present. Here is the code I have right now. <?php if (file_exists($entry->getCardImage)) { echo $entry->getCardImage(); } else { print '<img src="http://www.villagebaptisthome.org/sites/default/files/images/placeholder.thumbnail.png"/>'; } ?> Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/202011-if-else-file-exists-statement/ Share on other sites More sharing options...
kenrbnsn Posted May 17, 2010 Share Posted May 17, 2010 And your problem is? Link to comment https://forums.phpfreaks.com/topic/202011-if-else-file-exists-statement/#findComment-1059475 Share on other sites More sharing options...
thetechieone Posted May 17, 2010 Author Share Posted May 17, 2010 Well the problem was, I was getting the default image on all entries. I have it working now. Here is the code I used. <?php if ($entry->getCardImage() != null) { echo $entry->getCardImage(); } else { print '<img src="http://www.villagebaptisthome.org/sites/default/files/images/placeholder.thumbnail.png"/>'; } ?> Link to comment https://forums.phpfreaks.com/topic/202011-if-else-file-exists-statement/#findComment-1059757 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.