Thumbnailscript will nicht
Ben
- php
Hallo,
entweder liegt es daran, dass es schon spät ist oder ich bin einfach zu doof...
Das nachfolgende Script liefert mir diese Fehlermeldungen:
Warning: open_basedir restriction in effect. File is in wrong directory in /home/www/doc/5991/bens-homepage.de/www/wob4u/edit_profil.php on line 31
Warning: getimagesize: Unable to open '/' for reading. in /home/www/doc/5991/bens-homepage.de/www/wob4u/edit_profil.php on line 31
----------------------------------------------------- Script
if($file)
{
$filename = $file['name'];
$tempname = $file['tmp_name'];
$filesize = $file['size'];
$pathinfo = pathinfo($filename);
$size = getImageSize($tempname);
mt_srand((double)microtime()*1000000);
$name = mt_rand('0','10000');
if (strtolower($pathinfo['extension']) == 'jpg' || strtolower($pathinfo['extension']) == 'jpeg')
{
if (is_uploaded_file($file['tmp_name']))
{
copy($file['tmp_name'], "images/community/big/".$userid.".jpg");
mysql_query("UPDATE user_profile SET user_image = '1', public_image = '1' WHERE user_id = '$userid'");
// Original resizen - start
if ( $size[0] > 640 ) {
$file = "images/community/big/".$userid.".jpg";
$target = "images/community/big/".$userid.".jpg";
$max_width = "640";
$quality = "90";
$src_img = imagecreatefromjpeg($file);
$picsize = getimagesize($file);
$src_width = $picsize[0];
$src_height = $picsize[1];
if($src_width > $max_width)
{
$convert = $max_width/$src_width;
$dest_width = $max_width;
$dest_height = ceil($src_height*$convert);
}
else
{
$dest_width = $src_width;
$dest_height = $src_height;
}
$dst_img = imagecreatetruecolor($dest_width,$dest_height);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
imagejpeg($dst_img, "$target", $quality);
// Original resizen - ende
}
// Thumbnail erstellen - start
$file = "images/community/big/".$userid.".jpg";
$target = "images/community/thumb/".$userid.".jpg";
$max_width = "150";
$quality = "90";
$src_img = imagecreatefromjpeg($file);
$picsize = getimagesize($file);
$src_width = $picsize[0];
$src_height = $picsize[1];
if($src_width > $max_width)
{
$convert = $max_width/$src_width;
$dest_width = $max_width;
$dest_height = ceil($src_height*$convert);
}
else
{
$dest_width = $src_width;
$dest_height = $src_height;
}
$dst_img = imagecreatetruecolor($dest_width,$dest_height);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
imagejpeg($dst_img, "$target", $quality);
// Thumbnail erstellen - ende
}
}
}
-----------------------------------------------------
Wäre für Tipps und Hinweise extrem dankbar...
Viele Grüße
Ben
hi,
Warning: open_basedir restriction in effect. File is in wrong directory in /home/www/doc/5991/bens-homepage.de/www/wob4u/edit_profil.php on line 31
Warning: getimagesize: Unable to open '/' for reading. in /home/www/doc/5991/bens-homepage.de/www/wob4u/edit_profil.php on line 31
Wäre für Tipps und Hinweise extrem dankbar...
scheint mir nicht so ... PHP gibt dir in den warnings doch schon hinweise, warum findest du nicht erst mal heraus, was es damit auf sich hat?
http://www.php.net/manual/en/features.safe-mode.php
http://www.php-faq.de/q/q-konfiguration-safe-mode.html
gruß,
wahsaga
Hi,
scheint mir nicht so ... PHP gibt dir in den warnings doch schon hinweise, warum findest du nicht erst mal heraus, was es damit auf sich hat?
http://www.php.net/manual/en/features.safe-mode.php
http://www.php-faq.de/q/q-konfiguration-safe-mode.html
Danke für die Links. Bei meinem Provider ist der safe_mode auf OFF und so muss das ja auch sein.
Dafür habe ich bemerkt, dass die Variable $bild['tmp_name'] den Inhalt "/" hat, kann es mir aber leider nicht erklären. Es gibt doch für mit dem Typ file verarbeitete Input-Felder einige globale Eigenschaften, oder?
Gruß
Ben