My script always worked fine on localhost. Now I've moved all my images on another website and the script won't work anymore. Why is this, and how can I fix it?
Error:
Warning: filesize(): stat failed for http://data.localsky.net/panel/img/blocked/box_main.gif in C:\xampp\htdocs\Projects\MVC\application\class.security.php on line 15
I call the function with:
baseImg('http://data.localsky.net/panel/img/blocked/box_main.gif', false);
public function baseImg($path, $auto=true) {
$img_src = $path;
$imgbinary = fread(fopen($img_src, "r"), filesize($img_src));
$img_str = base64_encode($imgbinary);
if ( preg_match('/(?i)msie [1-8]/', $_SERVER['HTTP_USER_AGENT']) ) {
if($auto) {
return '<img src="'.$img_scr.'" />';
} else {
echo $img_src;
}
} else {
if($auto) {
return '<img src="data:image/jpg;base64,'.$img_str.'" />';
} else {
return 'data:image/jpg;base64,'.$img_str;
}
}
}