claviska / SimpleImage

A PHP class that makes working with images and GD as simple as possible.
MIT License
1.38k stars 383 forks source link

error uploading image when resize image using bestFit() #244

Closed khairil01 closed 5 years ago

khairil01 commented 5 years ago

when i uploading the image, its show errors.

  1. Warning (2): imagesx() expects parameter 1 to be resource, null given [ROOT/vendor/claviska/simpleimage/src/claviska/SimpleImage.php, line 437]
  2. Warning (2): imagesy() expects parameter 1 to be resource, null given [ROOT/vendor/claviska/simpleimage/src/claviska/SimpleImage.php, line 405]

I resize the image using bestFit(1110 , 500)

$image = new \claviska\SimpleImage($image); $img = $image->bestFit(1110,500); $img->toFile($savePath, 'image/png');

claviska commented 5 years ago

Check the initial value of $image. Make sure you’re using fromFile() or a similar method to load the image. On Jul 19, 2019, 9:55 AM -0400, khairil01 notifications@github.com, wrote:

when i uploading the image, its show errors.

  1. Warning (2): imagesx() expects parameter 1 to be resource, null given [ROOT/vendor/claviska/simpleimage/src/claviska/SimpleImage.php, line 437]
  2. Warning (2): imagesy() expects parameter 1 to be resource, null given [ROOT/vendor/claviska/simpleimage/src/claviska/SimpleImage.php, line 405]

I resize the image using bestFit(1110 , 500) $image = new \claviska\SimpleImage($image); $img = $image->bestFit(1110,500); $img->toFile($savePath, 'image/png'); — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

claviska commented 5 years ago

Closing due to no response. If this is still an issue, please post more info and we'll try to help.