rokka-io / imagine-vips

libvips adapter for php imagine
https://rokka.io
Other
41 stars 8 forks source link

Image::save must return ImageInterface #13

Closed batyrmastyr closed 1 year ago

batyrmastyr commented 4 years ago

Currently, with VIPS 8.9 empty array is returned. https://github.com/rokka-io/imagine-vips/blob/5cd6490121686aa938715839f6c6abb282e859c7/lib/Imagine/Vips/Image.php#L427-L442

Additionally, Layers::coalesce return nothing instead of self. And one more thing: there are public const declarations. They were introduced in php 7.1, but php 7.0 is required.

Oh, Effects::modulate returns inexistent RokkaImageInterface.

batyrmastyr commented 3 years ago

@chregu bump

chregu commented 1 year ago

The main issues (with PHP 8.1 and some other type mismatches) were fixed in #27 - The others (adding types everywhere) we won't fix due to too many BC issues.

batyrmastyr commented 1 year ago

@chregu looks like the main bug fix is missing: this change in Image::save

try {
-                 return $vips->$method($path, $saveOptions);

+                 $vips->$method($path, $saveOptions);
+                 return $this;
             }

Current code returns a result of calling jpegsave, pngsave and other *save vips-php methods instead of declared ImageInterface. And it looks like the same adjustment should be done in Image::get.

chregu commented 1 year ago

Thanks for that. It's fixed in master. image::get should return a "string" with the image content, that is correct.