Strange problem with imagecreatefrompng

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Strange problem with imagecreatefrompng

Postby tognaco » 07. April 2005 07:09

I have a code to resize images that has been working to day without any problem at every server I have tried it, including some XAMPP (for Windows). But I have installed XAMPP 1.4.12 at Debian Sarge and the code doesn't work properly.

Code: Select all
if ($_FILES['imagen_conclusiones']['type']=="image/jpeg"){
    $img=imagecreatefromjpeg($nuevo_nombre);
    $bx=imagesx($img);
    $by=imagesy($img);
    if ($by>290){
        $my=290;
        $mx=intval($my*$bx/$by);
        $im=imagecreatetruecolor ($mx, $my);
        imagecopyresampled ($im, $img, 0, 0, 0, 0, $mx, $my, $bx, $by);
        imagejpeg($im,$nuevo_nombre,75);
        }
}elseif ($_FILES['imagen_conclusiones']['type']=="image/png"){
    $img=imagecreatefrompng($nuevo_nombre);
    $bx=imagesx($img);
    $by=imagesy($img);
    if ($by>290){
        $my=290;
        $mx=intval($my*$bx/$by);
        $im=imagecreatetruecolor ($mx, $my);
        imagecopyresampled ($im, $img, 0, 0, 0, 0, $mx, $my, $bx, $by);
        imagejpeg($im,$nuevo_nombre,75);
        }
}elseif ($_FILES['imagen_conclusiones']['type']=="image/x-png"){
    $img=imagecreatefrompng($nuevo_nombre);
    $bx=imagesx($img);
    $by=imagesy($img);
    if ($by>290){
        $my=290;
        $mx=intval($my*$bx/$by);
        $im=imagecreatetruecolor ($mx, $my);
        imagecopyresampled ($im, $img, 0, 0, 0, 0, $mx, $my, $bx, $by);
        imagejpeg($im,$nuevo_nombre,75);
        }
}


... and so. The code resizes perfectly images EXCEPT for png :?: . I have fixed that the problem is at the following line:

$img=imagecreatefrompng($nuevo_nombre);

but I´m sure that the code is correct. The PHP version is 5.0.2. Have tried also with 4.3 , but still doesn't work. And also tried to uninstall XAMPP 1.4.12 and install 1.4.9, but with the same results.

I don't know what more colud I try. Any suggestions would be greatly appreciated.
[/code]
tognaco
 
Posts: 3
Joined: 07. April 2005 06:55

Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 12 guests