Hi,
I am using a script to read file sizes out of ZIP compressed image files (http://www.sitepoint.com/forums/showthread.php?t=663771). For some reason the script is working perfectly in one directory, but not in any other.
Both directories are subdirectories of the webserver root directory.
owner, group and access rights are the same. There is no special .htaccess file for these folders.
I now turned on all PHP error messages. For the not working directory I get following message:
Strict Standards: getimagesize() [function.getimagesize]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /srv/www/vhosts/domain.tld/httpdocs/_test/zip.php on line 42
Warning: getimagesize(bild.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /srv/www/vhosts/domain.tld/httpdocs/_test/zip.php on line 42
Line 42 is 'list($width, $height) = getimagesize($filename);'
And this is the complete code:
PHP Code:
<?php
$dbfilename = "/srv/www/vhosts/domain.tld/httpdocs/1-tests/bild.zip";
if (preg_match('/\.zip\b/i', $dbfilename)) {
$zip = new ZipArchive();
if (true !== $zip->open($dbfilename))
{
throw new Exception('ZIP archive, '.$dbfilename.', konnte nicht geoeffnet werden!');
}
// Search for the image file.
for($i = 0; $i < $zip->numFiles; $i++)
{
$entry = $zip->statIndex($i);
$ext = substr($entry['name'], -3);
if (in_array($ext, array('jpg', 'jpeg', 'png', 'psd', 'tif', 'tiff', 'pdf', 'gif', 'pct')) && (!preg_match('/\/\./i', $entry['name'])))
{
$filename = $entry['name'];
}
}
if (isset($filename) && ($image = $zip->getFromName($filename)))
{
list($width, $height) = getimagesize($filename);
echo "w $width - h $height<br />";
}
else
{
throw new Exception('No image found');
}
}
else {
}
?>
I really don't understand what is happening on this server...
Thanks for any help!
Regards
Flözen
Bookmarks