If.. then.. else with images
-
I’m not a programmer, but I really thought this would work. Want to write the following if.. then.. else.. statement:
-The file is the name of the post and is in the uploads directory
IF
file exists
THEN
tell me it exists
ELSE
tell me it doesn’tFor some reason the code below outputs “the blog url” and then says “the file doesn’t exist”… when it does.
Any help would be greatly appreciated!!
Thanks
Steve<?php
$url = ‘/wp-content/uploads/’ . get_the_ID();
$image_file = get_the_title();
$full_url = bloginfo(‘url’) . $url . ‘/’ . $image_file;if (file_exists($full_url)) {
echo “The file exists”;
} else {
echo “The file does not exist”;
}
?>
- The topic ‘If.. then.. else with images’ is closed to new replies.