Open LeTraceurSnork opened 5 days ago
You need to manually include/require WP's image editor class whichever file that is in. WordPress doesn't use autoload.
I'm also not sure that it's a good idea to use the storage image editor directly but ymmv.
On Oct 30, 2024, at 4:00 PM, LeTraceurSnork @.***> wrote:
Describe the bug Cannot instantiate any of ImageEditors classes with an error:
Fatal error: Uncaught Error: Class "WP_Image_Editor" not found in ... To Reproduce Steps to reproduce the behavior:
Try to instantiate class StorageImageEditor like that: new StorageImageEditor($image_upload_dir . $file_name); Expected behavior Ability to instantiate the ImageEditor class and operate with it to be able upload files
Screenshots image.png (view on web) https://github.com/user-attachments/assets/207be80b-96b0-4921-8d18-5c1dd9657b6e Server (please complete the following information)
Linux 29dc86ad20f3 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 GNU/Linux PHP Version 8.2.17 Web Server | Ubuntu under Docker Using PHP-FPM? - No Using WordPress Cron? - No How did you install the plugin? Via composer (wpackagist-plugin/ilab-media-tools)
Additional context None
— Reply to this email directly, view it on GitHub https://github.com/Interfacelab/ilab-media-tools/issues/241, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAK3IJDUN7DBK6WNL2UZ5LZ6CN4RAVCNFSM6AAAAABQ3SVI7WVHI2DSMVQWIX3LMV43ASLTON2WKOZSGYZDGMZTGQ3TCMA. You are receiving this because you are subscribed to this thread.
You need to manually include
Well, ok, first of all - that helped
Second of all - I've managed to solve my problem in other way than StorageImageEditor
, nvm then
Third of all - IMHO that is nonsense:
not sure that it's a good idea to use the storage image editor directly
The plugin presents some functionality that not only I'm, as a user, not suppose to use (main contributor suggests it 😯), it also simply doesn't actually work w/o some additional manipulations
You shouldn't use it directly because it isn't intended to be used directly just like WP_Image_Editor isn't supposed to be used directly as it is an abstract class. You are supposed to use the image editor via the wp_image_editor() function because WordPress has to do some bookkeeping and other things before creating it.
But what do I know 🤷🏼♂️ You seem to have it all figured out.
On Oct 31, 2024, at 1:26 AM, LeTraceurSnork @.***> wrote: Third of all - IMHO that is nonsense:
not sure that it's a good idea to use the storage image editor directly
The plugin presents some functionality that not only I'm, as a user, not suppose to use (main contributor suggests it 😯), it also simply doesn't actually work w/o some additional manipulations
You shouldn't use it directly because it isn't intended to be used directly
At least, please, mention it in PHPDoc
Describe the bug Cannot instantiate any of ImageEditors classes with an error:
To Reproduce Steps to reproduce the behavior:
Expected behavior Ability to instantiate theImageEditor class and operate with it to be able upload files
Screenshots
Server (please complete the following information)
Linux 29dc86ad20f3 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 GNU/Linux
How did you install the plugin? Via composer (
wpackagist-plugin/ilab-media-tools
)Additional context None