Is file_exists() compatible with timthumb.php? [closed]

The file_exists() function is a built in php function and should work everywhere. But with the way you’re doing it, is wrong. You cannot use a query string within a php file to check if the file exists. Just because its a valid link, doesn’t mean the file_exists(). There is no file on your server by the name of /scripts/timthumb.php?src=*

You need to do the following to your code:

<?php
$content = $post->post_content;
$searchimages="~<img [^>]* />~";
preg_match_all($searchimages, $content, $pics);
$iNumberOfPics = count($pics[0]);
if($iNumberOfPics > 0){
    $blogTemplate = get_bloginfo('template_directory');
    $imgSrc = get_post_meta($post->ID, "thumb", $single = true);

    if(file_exists($imgSrc)){ 
    $imgSrc = $blogTemplate . "/scripts/timthumb.php?src="https://wordpress.stackexchange.com/questions/33197/. $imgSrc ."&w=300&zc=1";
    ?>
        <a href="<?php the_permalink(); ?>" class="thumb" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php echo $imgSrc; ?>" alt="<?php the_title(); ?>" /></a><?php              
    }
}
?>

This way you’re actually checking for the real file name and then changing the url to the query string url later, after you know the file exists.