admin2gd1 Posted September 3, 2008 Share Posted September 3, 2008 Here is something quick someone can help me with. I can't get the second image to show. If the photo in the database and directory doesn't exist then show image 2 but it's not doing it because it is still trying to read from the directory where the photos would be, so it ignores the second image in less that directory does not exist also. Now the thing is I have 12 photos all together in one directory and the directory needs to exist for the other 11 photos so what I want is the second image to show and not try to read from the directory. This is my code that I am using, don't worry about $SITEurl and $username and $name they are working. <?php if(file_exists("../photos/properties/$username/$name/$photo1")){ ?> <img class="photo" src="<?php echo $SITEurl ?>/photos/properties/<?php echo $username; ?>/<?php echo $name; ?>/<?php echo $photo1; ?>" alt=""> <?php }else{ ?><img class="photo" src="<?php echo $SITEurl; ?>/images/<?php echo getLang(noimage); ?>" alt=""><?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/122574-if-file-exists-show-image-uploaded-else-show-no-image-file/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.