Salve a tutti!

come mai questo codice non funziona?

Codice PHP:
// selezione la foto
        
$img $elem->img
        if (
substr($img,0,7)!="http://"$img "photo/$elem->sex/$elem->id".".".$img
        
    list(
$width$height$type$attr) = getimagesize("$img");

    if(
$width "500") {
        
$width "500";
    } else {
            
$width $width;
    } 
e non mi resitutisce nessun errore!