jimy,
$mime = curl_getinfo($curl, CURLINFO_CONTENT_TYPE); // Can not determine the original mime typeFix this function (+/-)
function is_remote_image($picture_remote_host)
{
$handle = fopen($picture_remote_host, 'rb');
if ($handle) {
$six_bytes = fread($handle, 6);
fclose($handle);
if ($six_bytes === false) {
return false;
}
if (substr($six_bytes, 0, 3) == "\xff\xd8\xff") {
return 'image/jpeg';
}
if ($six_bytes == "\x89PNG\x0d\x0a") {
return 'image/png';
}
if ($six_bytes == "GIF87a" || $six_bytes == "GIF89a") {
return 'image/gif';
}
}
return false;
}
function _img_njobo($var)
{
return preg_replace_callback('#\[img\](.*?)\[/img\]#si', function ($img) {
if (!is_remote_image($img[1])) {
return '<strong class="red">[BROKEN IMAGE]</strong>';
} else {
return '<img src="' . $img[1] . '" alt=""/>';
}
}, $var);
}