Salve a tutti, ho trovato su internet questo script per riconosce da link se un file è un immagine:
Codice PHP:
if(strlen($testo_form_photo) > 0)
{
$FilePointer = fopen($testo_form_photo, "r");
if($FilePointer)
{
$FileHeaders = stream_get_meta_data($FilePointer);
foreach($FileHeaders as $FileHeader)
{
foreach($FileHeader as $HeaderValue)
{
if(strpos(strtolower($HeaderValue), "image/jpg"))
{echo "ok";}
}
}
}
}
Se però provo ad usarlo ricevo una lunga serie di errori:
[24-Apr-2012 15:55:49 UTC] PHP Warning: strtolower() expects parameter 1 to be string, array given in index.php on line 1292
[24-Apr-2012 15:55:49 UTC] PHP Warning: strtolower() expects parameter 1 to be string, resource given in index.php on line 1292
[24-Apr-2012 15:55:49 UTC] PHP Warning: Invalid argument supplied for foreach() in index.php on line 1290
[24-Apr-2012 15:55:49 UTC] PHP Warning: Invalid argument supplied for foreach() in index.php on line 1290
[24-Apr-2012 15:55:49 UTC] PHP Warning: Invalid argument supplied for foreach() in index.php on line 1290
[24-Apr-2012 15:55:49 UTC] PHP Warning: Invalid argument supplied for foreach() in index.php on line 1290
[24-Apr-2012 15:55:49 UTC] PHP Warning: Invalid argument supplied for foreach() in index.php on line 1290
[24-Apr-2012 15:55:49 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/worldte1/public_html/user/index.php on line 1290
[24-Apr-2012 15:55:49 UTC] PHP Warning: Invalid argument supplied for foreach() in index.php on line 1290
[24-Apr-2012 15:55:49 UTC] PHP Warning: Invalid argument supplied for foreach() in index.php on line 1290
[24-Apr-2012 15:55:49 UTC] PHP Warning: Invalid argument supplied for foreach() in index.php on line 1290
Ho notato che $FilePointer contiene "Resource id #30", sapete quale possa essere il problema?