libvips / php-vips

php binding for libvips
MIT License
618 stars 25 forks source link

unable to open for read #124

Closed lerni closed 2 years ago

lerni commented 2 years ago

vips 8.12.0

PHP 7.4

I'm on an OSX Hombrew stack and would like to use libvips with Silverstripe per osiemsiedem/intervention-image-vips-driver (dev-master ATM 9a6f1d47d5c280a4a106564e6ed4b71098f02559). It reaches Jcupitt\Vips\Image, but there it can't read the file, even tough it actually is readable. I'm happy to provide further infos (need to know what) since I do not get why it says it cannot read.

This file IS readable and PHP is running as the same user (SOME). In fact the folder it is in, was created per PHP.

-rw-r--r--   1 SOME  staff   175K 29 Nov 15:28 interventionimage_YWqmkt.jpg
ERROR [Emergency]: Uncaught Jcupitt\Vips\Exception: /Users/SOME/webroot/PROJECT/silverstripe-cache/SOME/interventionimage_MpUTxf.jpg: unable to open for read
Unix-Fehler: No such file or directory

IN POST /admin/assets/api/createFile
Line 778 in /Users/SOME/webroot/PROJECT/vendor/jcupitt/vips/src/Image.php

Source
======
  769:      * @throws Exception
  770:      *
  771:      * @return void
  772:      *
  773:      * @internal
  774:      */
  775:     private static function errorVips(): void
  776:     {
  777:         $message = vips_error_buffer();
* 778:         $exception = new Exception($message);
  779:         Utils::errorLog($message, $exception);
  780:         throw $exception;
  781:     }
  782: 
  783:     /**
  784:      * Check the result of a vips_ call for an error, and throw an exception

Trace
=====
Jcupitt\Vips\Image::errorVips()
Image.php:1183

Jcupitt\Vips\Image->writeToBuffer(.jpg, Array)
Encoder.php:25

Intervention\Image\Vips\Encoder->processJpeg()
AbstractEncoder.php:139

Intervention\Image\AbstractEncoder->process(, jpg, 84)
AbstractDriver.php:79

Intervention\Image\AbstractDriver->encode(, jpg, 84)
Image.php:121

Intervention\Image\Image->encode(jpg, 84)
InterventionBackend.php:369
jcupitt commented 2 years ago

Hi @lerni ,

That's weird, it should work.

I'd guess there was some kind of install issue, so I'd first verify that the C extension is working. Try php_info and make sure it's enabled.

lerni commented 2 years ago

hi @jcupitt - wowh thx for the swift reply!

Meanwhile I've tried on a linux box and it behaved similar but with that setup I had not set any breakpoints and after the request, the file wasn't there. So I tried locally again to discover, the file in my local temp is most probable a relic from an earlier attempt :facepalm: Sorry I have to dig in further... I'll close if I cannot nail it further down but before I do so, need a bit time.

PHP info says:

Vips headers version => 8.11.4
Vips library version => 8.12.0
Vips ABI version => 56.0.14
Major version => 8
Minor version => 12
Micro version => 0
Cache max mem => 104857600
Cache max operations => 100
Cache current operations => 41
Cache max open files => 100
Memory allocations => 0
Memory currently allocated => 0
Memory high water => 248219
Concurrency => 12
SIMD support with liborc => yes
JPEG support => yes
PNG support => yes
TIFF support => yes
GIF support => yes
OpenEXR support => yes
load OpenSlide => yes
load Matlab => yes
load PDF => yes
load SVG => yes
FITS support => yes
WebP support => yes
HEIF support => yes
load with libMagick => yes
Text rendering support => yes
ICC profile support with lcms => yes
lerni commented 2 years ago

This isn't resolved but my gut feeling says there is another cause - also priorities have changed. I'll reopen or create a new issue if it persists. Sorry for the noise.