this question has answer here:
i need resizing image script in php, need this: https://gist.github.com/nomisoft/11403298 script works perfect resized gif image isn't animated. need resize gif,jpg,jpeg , png images highest quality, , gif images animated later & png images transparent.
sorry bad english. thank you.
for animated gif images, may use https://github.com/glukash/glu-image
for jpg, jpeg, png, etc. http://image.intervention.io/api/make http://image.intervention.io/api/resize
$this->image_manager = new intervention\image\imagemanager(['driver' => 'imagick']); $this->max_width = 800; public function resizeimage($resource) { $image = $this->image_manager->make($resource); if ($image->width() <= $this->max_width) { return $resource; } return $image->resize($this->max_width, null, function ($constraint) { $constraint->aspectratio(); $constraint->upsize(); })->save(); }
Comments
Post a Comment