Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/03/2009, 15:31
viktoria
 
Fecha de Ingreso: septiembre-2006
Mensajes: 349
Antigüedad: 18 años, 5 meses
Puntos: 0
imagejpeg con verion php 5.1.6

Buenas tardes a todos,

Tengo una clase que gestiona ficheros y tambien hace tratamiento de imagenes (basico). Me esta funcionando en todas aplicaciones en mi servidor que tiene php 5.2.4.

Pero tengo una aplicacion alojada en servidor que no es mio y alli la version de php es 5.1.6. ME da error funcion imagejpeg

Código PHP:
Warningimagejpeg() [function.imagejpeg]: Unable to open '/crm/eventos/content/picture/res/137_15.jpg' for writing in .......FileMng.php on line 961 
He probado aplicar siguentes soluciones

Código PHP:
case "jpeg":
                 
chmod($folder0777); 
                 
header("Content-type: image/jpeg"); 
                 
imagejpeg($temp$folder.$this -> name);

                 
imagedestroy($temp); 

Código PHP:
case "jpeg":
                 
chmod($folder.$this -> name0777); 
                
ini_set("safe_mode","Off");
                 
imagejpeg($temp$folder.$this -> name);
ini_set("safe_mode","On");
                 
imagedestroy($temp); 

AL intentar utilizar fopen() me dice que no existe tal fichero. O sea que ni lo intenta crear.

Adjunto el codigo de funcion resize de mi clase. Si hace falta pongo todo el codigo de la clase. Seguro que tiene fallos, pero el echo es que me funciona con PHP 5.2.4 y no con 5.1.6

Código PHP:
    public function resize($folder ""$w ""$h ""){

        

        if(!
$w){

            
$w WIDTH_MAX;

        }

        if(!
$h){

            
$h HEIGHT_MAX;

        }

         

         if(!
$folder){

            
$folder $this -> getResUrl();

         }

         

         if (!
function_exists("imagecreate"))

         {

            echo 
"Error: GD Library is not available.";

             return 
false;

         }



        if(
$this -> width $w || $this -> height $h) {

        

            if(
$dif 1){

                
/* height < width */

                
$newWidth $w;

                
$newHeight $this -> height /($this -> width $w);

            }

                    

            
/* height > width */

            
if($dif 1){

                
$newHeight=$h;

                
$newWidth=$this -> width /($this -> height $h);

            }    

            

            
/* height = width */

            
if($dif == 1){

                
$diference $this -> width $w;

                
$newWidth $w;

                
$newHeight $this -> height $diference;

            }

    

        } else {

            
$newWidth $w;

            
$newHeight $h;

        }

        

    

      
/* create an empty image with requested height/width */

     
$temp imagecreatetruecolor($newWidth$newHeight);

    

    
/* Create a new image from file or URL */
     
     
switch($this -> ext){

         case 
"gif":

         
$image imagecreatefromgif($this -> path);

         break;

         case 
"jpg":

         
$image imagecreatefromjpeg($this -> path);

         break;

         case 
"jpeg":
        
         
$image imagecreatefromjpeg($this -> path);

         break;

         case 
"png":

         
$image imagecreatefrompng($this -> path);

         break;

     }

    if(!
imagecopyresampled($temp$image0000$newWidth$newHeight$this -> width$this -> height)){

         
trigger_error(IMAGECOPYRESAMPLED_FAIL);

         return 
false;

    } else {



    
/* Create a new image from file or URL */

        

         
switch($this -> ext){

             case 
"gif":

                 
imagegif($temp$folder.$this -> name);

                 
imagedestroy($temp);

                 break;

             case 
"jpg":
            
                
imagejpeg($temp$folder.$this -> name100);
            
                 
imagedestroy($temp);

             break;

             case 
"jpeg":
                 
chmod($folder0777); 
                 
header("Content-type: image/jpeg"); 
                 
imagejpeg($temp$folder.$this -> name);

                 
imagedestroy($temp);

             break;

             case 
"png":

                 
imagepng($temp$folder.$this -> name);

                 
imagedestroy($temp);

             break;

         }

      } 




Gracias a todos!