You are not logged in.
Pages: 1
Topic closed
The Installation fails with a white page and following log error on glpi .80.7
apache2: PHP Fatal error: Cannot re-assign auto-global variable _FILES in /usr/share/glpi/plugins/resources/inc/resource.class.php on line 435
i got it working with an older System and php 5.3
greetings Christian
Offline
Hi,
I have the same error.
For solve this, edit your file "resource.class.php on line 435" and change $_FILES by $files
my code before edit (with error) :
function addPhoto($_FILES,$class)
{
$uploadedfile= $_FILES['picture']['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);
list($width,$height)=getimagesize($uploadedfile);
$newwidth=75;
$newheight=($height/$width)*$newwidth;
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$ext = strtolower(substr(strrchr($_FILES['picture']['name'], '.'), 1));
$resources_name = str_replace(" ","", strtolower($class->fields["name"]));
$resources_firstname = str_replace(" ","", strtolower($class->fields["firstname"]));
$name = $resources_name."_".$resources_firstname.".".$ext;
$name = $this->replace_accents($name);
$tmpfile = GLPI_DOC_DIR."/_uploads/". $name;
$filename = GLPI_PLUGIN_DOC_DIR."/resources/". $name;
imagejpeg($tmp,$tmpfile,100);
rename($tmpfile,$filename);
//Document::renameForce($tmpfile, $filename);
imagedestroy($src);
imagedestroy($tmp);
return $name;
}
and after edit (without error)
function addPhoto($files,$class)
{
$uploadedfile= $files['picture']['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);
list($width,$height)=getimagesize($uploadedfile);
$newwidth=75;
$newheight=($height/$width)*$newwidth;
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$ext = strtolower(substr(strrchr($files['picture']['name'], '.'), 1));
$resources_name = str_replace(" ","", strtolower($class->fields["name"]));
$resources_firstname = str_replace(" ","", strtolower($class->fields["firstname"]));
$name = $resources_name."_".$resources_firstname.".".$ext;
$name = $this->replace_accents($name);
$tmpfile = GLPI_DOC_DIR."/_uploads/". $name;
$filename = GLPI_PLUGIN_DOC_DIR."/resources/". $name;
imagejpeg($tmp,$tmpfile,100);
rename($tmpfile,$filename);
//Document::renameForce($tmpfile, $filename);
imagedestroy($src);
imagedestroy($tmp);
return $name;
}
beware, this code is take from V 01.8.0
Offline
test this please :
Xavier Caillaud
Blog GLPI Infotel
Offline
thank you,
the plugin installs now.
greetings
Christian
Offline
Pages: 1
Topic closed