compress-image
compress-image copied to clipboard
Doubt about file_url
Why do you add the prefix conteudo/
in the url of the images to be compressed?
$new_image = imagecreatefrompng('conteudo/'.$this->file_url);
Hey, i haven´t developed this library but i used it, so i deleted this directory string. I thought it was an error. Code has to be as shown: $maxImgWidth = 900; // create image from posted file $src = imagecreatefrompng($this->file_url); // get original size of uploaded image list($width, $height) = getimagesize($this->file_url); if ($width > $maxImgWidth) { $newwidth = $maxImgWidth; $newheight = ($height / $width) * $newwidth; $newImage = imagecreate($newwidth, $newheight); imagecopyresampled($newImage, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagepng($newImage, $this->destination.$this->new_name_image, $png_compression); imagedestroy($src); imagedestroy($newImage); $resizedFlag = true; } Happy code :)
That's a mistake JeisonJ. Soon as possible i'll change this.
The above mentioned issue still exists. Please update asap. I got an error while uploading a png image on this code
$new_image = imagecreatefrompng('conteudo/'.$this->file_url);
Try deleting conteudo folder $new_image = imagecreatefrompng($this->file_url);
Try deleting conteudo folder $new_image = imagecreatefrompng($this->file_url);
I' ve fixed it by doing the same. That is not a permenant solution right?. when I do a composer update then, the changes will rollback to the default one.