compress-image icon indicating copy to clipboard operation
compress-image copied to clipboard

Doubt about file_url

Open jeisonjs opened this issue 5 years ago • 5 comments

Why do you add the prefix conteudo/ in the url of the images to be compressed?

$new_image = imagecreatefrompng('conteudo/'.$this->file_url);

jeisonjs avatar Jun 02 '19 01:06 jeisonjs

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 :)

joaquinpco avatar Jun 03 '19 15:06 joaquinpco

That's a mistake JeisonJ. Soon as possible i'll change this.

eihror avatar Jun 06 '19 11:06 eihror

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);

AjithLalps avatar Jun 19 '19 12:06 AjithLalps

Try deleting conteudo folder $new_image = imagecreatefrompng($this->file_url);

joaquinpco avatar Jun 19 '19 13:06 joaquinpco

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.

AjithLalps avatar Jun 20 '19 04:06 AjithLalps