Foros del Web » Programando para Internet » PHP »

warnin libreria de simple image

Estas en el tema de warnin libreria de simple image en el foro de PHP en Foros del Web. estoy usando la librería de simpleimage para re dimensionar imágenes y me tira los siguientes errores. Warning: getimagesize(blogimg/A2.jpg): failed to open stream: No such file ...
  #1 (permalink)  
Antiguo 17/11/2018, 22:14
 
Fecha de Ingreso: diciembre-2008
Mensajes: 122
Antigüedad: 15 años, 4 meses
Puntos: 1
Pregunta warnin libreria de simple image

estoy usando la librería de simpleimage para re dimensionar imágenes y me tira los siguientes errores.

Warning: getimagesize(blogimg/A2.jpg): failed to open stream: No such file or directory in C:\xampp\htdocs\LTF\Web\admin\SimpleImage.php on line 9

Warning: imagesx() expects parameter 1 to be resource, null given in C:\xampp\htdocs\LTF\Web\admin\SimpleImage.php on line 41

Warning: imagesy() expects parameter 1 to be resource, null given in C:\xampp\htdocs\LTF\Web\admin\SimpleImage.php on line 44

Warning: imagecopyresampled() expects parameter 2 to be resource, null given in C:\xampp\htdocs\LTF\Web\admin\SimpleImage.php on line 63

Aca el codigo que uso de mi archivo

Código PHP:
<?php
if(isset($_POST["enviar"])){
    
$i = isset($_GET['i']) ? $_GET['i'] : null;
    include(
"simpleimage.php");
    
$php composer.phar require intervention/image
    $sql
=mysqli_query($conn "SELECT * FROM blog ORDER BY `id` ASC ");
    if(
$_POST["titulo"]=="" and $_POST["mensaje"]==""){
        
$b=2;
    }
    else{
        
$b=1;
        while(
$rsmysqli_fetch_array($sql)){
        
$i $rs["id"] + 1;
        }
        
//foto
        
if($_FILES["foto"]["name"]==""){
        
$imagena="";
        
$thumb ="";
        echo 
"aaaaaaaaaaaa";
        }
        else{
            echo 
"estoy aca";
        
$ext strrchr($_FILES["foto"]["name"],'.');    
        
$id_foto "A".$i;  
        
$id_foto_db="blogimg/".$id_foto."".$ext;
        
$id_foto_thumb="blogimg/thumb/".$id_foto."".$ext;
        
move_uploaded_file($_FILES["foto"]["tmp_name"],$id_foto_db."".$ext);
        
$imagena $id_foto_db;
        
$thumb $id_foto_thumb;
           
$image = new SimpleImage();
        
$image->load($id_foto_db);
         
$image->resize(148,142);
          
$image->save($id_foto_thumb);
        }
        
$hoy date("Y-m-d H:i:s");
      
mysqli_query($conn "insert into blog (titulo,fecha,noticia,foto,thumb) values ('".$_POST['titulo']."','".$hoy."','".$_POST['mensaje']."','".$imagena."','".$thumb."')");
    }
}
?>
Este otro es el de simple image:
Código PHP:
<?php
ini_set
("memory_limit","1000M");
class 
SimpleImage {
   
   var 
$image;
   var 
$image_type;
 
   function 
load($filename) {
      
$image_info getimagesize($filename);
      
$this->image_type $image_info[2];
      if( 
$this->image_type == IMAGETYPE_JPEG ) {
         
$this->image imagecreatefromjpeg($filename);
      } elseif( 
$this->image_type == IMAGETYPE_GIF ) {
         
$this->image imagecreatefromgif($filename);
      } elseif( 
$this->image_type == IMAGETYPE_PNG ) {
         
$this->image imagecreatefrompng($filename);
      }
   }
   function 
save($filename$image_type=IMAGETYPE_JPEG$compression=75$permissions=null) {
      if( 
$image_type == IMAGETYPE_JPEG ) {
         
imagejpeg($this->image,$filename,$compression);
      } elseif( 
$image_type == IMAGETYPE_GIF ) {
         
imagegif($this->image,$filename);         
      } elseif( 
$image_type == IMAGETYPE_PNG ) {
         
imagepng($this->image,$filename);
      }   
      if( 
$permissions != null) {
         
chmod($filename,$permissions);
      }
   }
   function 
output($image_type=IMAGETYPE_JPEG) {
      if( 
$image_type == IMAGETYPE_JPEG ) {
         
imagejpeg($this->image);
      } elseif( 
$image_type == IMAGETYPE_GIF ) {
         
imagegif($this->image);         
      } elseif( 
$image_type == IMAGETYPE_PNG ) {
         
imagepng($this->image);
      }   
   }
   function 
getWidth() {
      return 
imagesx($this->image);
   }
   function 
getHeight() {
      return 
imagesy($this->image);
   }
   function 
resizeToHeight($height) {
      
$ratio $height $this->getHeight();
      
$width $this->getWidth() * $ratio;
      
$this->resize($width,$height);
   }
   function 
resizeToWidth($width) {
      
$ratio $width $this->getWidth();
      
$height $this->getheight() * $ratio;
      
$this->resize($width,$height);
   }
   function 
scale($scale) {
      
$width $this->getWidth() * $scale/100;
      
$height $this->getheight() * $scale/100
      
$this->resize($width,$height);
   }
   function 
resize($width,$height) {
      
$new_image imagecreatetruecolor($width$height);
      
imagecopyresampled($new_image$this->image0000$width$height$this->getWidth(), $this->getHeight());
      
$this->image $new_image;   
   }      
}
?>

Etiquetas: image, libreria, mysql, query, select, simple
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:11.