-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot instantiate any of ImageEditors classes #241
Comments
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 <#241>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAAK3IJDUN7DBK6WNL2UZ5LZ6CN4RAVCNFSM6AAAAABQ3SVI7WVHI2DSMVQWIX3LMV43ASLTON2WKOZSGYZDGMZTGQ3TCMA>.
You are receiving this because you are subscribed to this thread.
|
Well, ok, first of all - that helped
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
|
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 the ImageEditor 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
The text was updated successfully, but these errors were encountered: