php - file_exists() not working ,but when url of image is given in browser, image is displayed -


file_exists not working!! when url ($img in code) given in browser, image displayed. know file_exists() takes harddrive path understand, please ..

include_once("../inc/inc_constants.php");  include_once("database/db.php");  include_once("includes/global.php");  ini_set('max_execution_time',300);           $sql="select plan_image_name mp_new_project_images                   project_code in                   (select project_code mp_new_project                     project_status='active' ) ";             $sql_result=mysql_query($sql) or die(mysql_error());            while($sqlrow=mysql_fetch_array($sql_result))         {           //home "http://ip address/"      $img  = home."images/properties/thumbs_400/".$sqlrow['plan_image_name']." ";      if(file_exists($img))     {      $dest =home."images/properties/thumbs_400/compress_50/".$sqlrow['plan_image_name']." ";     $dest1=home."images/properties/thumbs_400/compress_20/".$sqlrow['plan_image_name']." ";     $dest2=home."images/properties/thumbs_400/compress_10/".$sqlrow['plan_image_name']." ";      $size = getimagesize($img);      switch($size['mime']) {         case 'image/jpeg':             $im=imagecreatefromjpeg($img);             imagejpeg($im,$dest,50);             imagejpeg($im,$dest1,20);             imagejpeg($im,$dest2,10);         break;         case 'image/png':              $im = imagecreatefrompng($img);              imagepng($im,$dest,50);              imagepng($im,$dest1,20);              imagepng($im,$dest2,10);        break;         case 'image/gif':             $im = imagecreatefromgif($img);             imagegif($im,$dest,50);             imagegif($im,$dest1,20);             imagegif($im,$dest2,10);         break;         default:             return false;         break;         }     }  } 

file name should path file or directory not ip address

'home' constant should /var/www/html not ('http://url') example   $img  = home."images/properties/thumbs_400/".$sqlrow['plan_image_name']." ";  if(file_exists($img)) {  } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -