Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted February 13, 20204 yr I'm seeing a client utilizing my Gallery Enhancments plugin running into the following error, RuntimeException::0 IPS\File\_FileSystem->getImageDimensions() This is caused by the file not existing here, if ( ! file_exists( $file ) ) { throw new \RuntimeException; } ..and the reason the file doesn't exist, is because the client is using S3 storage, not the FileSystem. So.. why is IPS making a call to \IPS\File\FileSystem, not \IPS\File\Amazon? Code in question: https://github.com/FujiMakoto/ips-gallery-enhancements/blob/master/hooks/GalleryImage.php#L40 This should be pulling from Amazon using the base getImageDimensions method in \IPS\File here, but apparently it's not?
February 13, 20204 yr It shouldn't be - sounds like there is some sort of misconfiguration on the clients site. What is the full stacktrace?
February 13, 20204 yr Author #0 [Redact]/init.php(820) : eval()'d code(56): IPS\File\_FileSystem->getImageDimensions() #1 [Redact]/system/Patterns/ActiveRecord.php(335): IPS\gallery\hook1028->get_originalData() #2 [Redact]/init.php(820) : eval()'d code(655): IPS\Patterns\_ActiveRecord->__get('originalData') #3 [Redact]/init.php(820) : eval()'d code(35): IPS\Patterns\rules_hook_ipsPatternsActiveRecord->__get('originalData') #4 [Redact]/uploads/template_2_dd7fa6b771626a3f041bfec4dc0472c8_view.php(2624): IPS\gallery\rules_hook_ipsGalleryImage->__get('originalData') #5 [Redact]/system/Theme/SandboxedTemplate.php(61): IPS\Theme\Cache\class_gallery_front_view->imageLightboxFrame(Object(IPS\gallery\Image)) #6 [Redact]/uploads/template_2_dd7fa6b771626a3f041bfec4dc0472c8_view.php(2594): IPS\Theme\_SandboxedTemplate->__call('imageLightboxFr...', Array) #7 [Redact]/system/Theme/SandboxedTemplate.php(61): IPS\Theme\Cache\class_gallery_front_view->imageLightbox(Object(IPS\gallery\Image), '\n<div data-cont...') #8 [Redact]/applications/gallery/modules/front/gallery/view.php(324): IPS\Theme\_SandboxedTemplate->__call('imageLightbox', Array) #9 [Redact]/init.php(820) : eval()'d code(34): IPS\gallery\modules\front\gallery\_view->manage() #10 [Redact]/system/Dispatcher/Controller.php(96): IPS\gallery\modules\front\gallery\hook1030->manage() #11 [Redact]/system/Content/Controller.php(50): IPS\Dispatcher\_Controller->execute() #12 [Redact]/applications/gallery/modules/front/gallery/view.php(61): IPS\Content\_Controller->execute() #13 [Redact]/system/Dispatcher/Dispatcher.php(152): IPS\gallery\modules\front\gallery\_view->execute() #14 [Redact]/index.php(13): IPS\_Dispatcher->run() #15 {main} I've had two people report this so far. I'm going to try and set up S3 locally in a bit and see if I can reproduce it myself. Not sure why this would be happening other than some kind of misconfiguration like you said.
February 13, 20204 yr Author Well I am actually able to reproduce this locally. Now just to figure out why.
February 13, 20204 yr Author Wow. Someone smack me. $file = \IPS\File::get('gallery_Image', $this->original_file_name); It's gallery_Images, not gallery_Image. It seems File::get does not throw any kind of error or exception if you provide an invalid storage extension, and this results in it sometimes "just working" if you're not using a custom setup. @Ryan Ashbrook is there a chance we can have a check performed here to prevent hard to debug issues like this in the future?
February 13, 20204 yr 35 minutes ago, Makoto said: Wow. Someone smack me. $file = \IPS\File::get('gallery_Image', $this->original_file_name); It's gallery_Images, not gallery_Image. It seems File::get does not throw any kind of error or exception if you provide an invalid storage extension, and this results in it sometimes "just working" if you're not using a custom setup. @Ryan Ashbrook is there a chance we can have a check performed here to prevent hard to debug issues like this in the future? I'll raise it.
Archived
This topic is now archived and is closed to further replies.