in reply to Re^2: Check if image file exists
in thread Check if image file exists
Perl's file-test operators only care about the file's location on your server. If the file's URI is /username/picture.jpg, that's almost certainly not the file's full pathname on your system. That might be something like /var/www/images/username/picture.jpg, or something entirely different. You'll have to prepend $picture with the filesystem location of your picture subdirectory. Also, use a different quoting method to get rid of those backslashed quotes:
$picture = "/$username/$picture"; my $picture_path = "/var/www/images$picture"; # or whatever if( -f $picture_path ){ $thumb30 = qq| <img src="$picture" /> |; } else { $thumb30 = qq| <img src="/images/noavatar50.png" /> |; }
Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.
|
|---|