Closed elefante closed 2 days ago
Same problem here. When i switch to the video engine, then the following call fails with the same error message:
https://thumbor.example.com/unsafe/110x90/filters:fill(white)/https://example.com/example.png
Just to be sure, the image referenced here is a .png
not a video.
With the default image engine pil
this suceeds just fine.
@elefante where you ever able to figure this out?
This is the stacktrace I'm getting
2023-07-10 14:30:04 thumbor:ERROR ERROR: Traceback (most recent call last):
File "/home/thumbor/venv/lib/python3.11/site-packages/tornado/web.py", line 1786, in _execute
result = await result
^^^^^^^^^^^^
File "/home/thumbor/venv/lib/python3.11/site-packages/thumbor/handlers/imaging.py", line 119, in get
return await self.check_image(kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thumbor/venv/lib/python3.11/site-packages/thumbor/handlers/imaging.py", line 116, in check_image
return await self.execute_image_operations()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thumbor/venv/lib/python3.11/site-packages/thumbor/handlers/__init__.py", line 205, in execute_image_operations
await self.get_image()
File "/home/thumbor/venv/lib/python3.11/site-packages/thumbor/handlers/__init__.py", line 303, in get_image
await self.after_transform()
File "/home/thumbor/venv/lib/python3.11/site-packages/thumbor/handlers/__init__.py", line 344, in after_transform
await self.filters_runner.apply_filters(
File "/home/thumbor/venv/lib/python3.11/site-packages/thumbor/filters/__init__.py", line 121, in apply_filters
await filter_to_run.run()
File "/home/thumbor/venv/lib/python3.11/site-packages/thumbor/filters/__init__.py", line 218, in run
results.append(await self.runnable_method(*self.params))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thumbor/venv/lib/python3.11/site-packages/thumbor/filters/__init__.py", line 56, in wrapper
return await filtered_function(self, *args2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thumbor/venv/lib/python3.11/site-packages/thumbor/filters/fill.py", line 57, in fill
self.fill_engine.image = self.fill_engine.gen_image(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thumbor/venv/lib/python3.11/site-packages/thumbor_video_engine/engines/video.py", line 125, in __getattr__
raise AttributeError("'Engine' object has no attribute '%s'" % attr)
AttributeError: 'Engine' object has no attribute 'gen_image'
The filter fill appears to call gen_image
on the default engine, which (for this specific call) is the video engine
I'm also having this issue. Any work-around?
I finally understand what is happening with this project. The documentation makes you think that it is not necessary to include the filters that are used in the standard engine.
Here is the environment variables according to the documentation at https://thumbor-video-engine.readthedocs.io/en/latest/
To enable transcoding between formats, add 'thumbor_video_engine.filters.format' to your FILTERS setting. If 'thumbor.filters.format' is already present, replace it with the filter from this package.
ENGINE = 'thumbor_video_engine.engines.video'
FILTERS = [
'thumbor_video_engine.filters.format',
'thumbor_video_engine.filters.still',
]
I changed the environment variables to include the filters I need when manipulating images in the default thumbor engine
ENGINE = 'thumbor_video_engine.engines.video'
FILTERS = [
'thumbor.filters.quality',
'thumbor.filters.fill',
'thumbor_video_engine.filters.format',
'thumbor_video_engine.filters.still',
]
Also, I had to use a fork of this project. The fork is at this link: https://github.com/eighteen73/thumbor-video-engine
@elefante That Eighteen73 fork is mine, I have submitted a PR to get this fixed in this repo.
Is #23 actually the same problem?
I see the issue. It stems from the fact that the fill filter re-instantiates the engine here
Normally, the engine has enough information to determine whether it's being used for an image or video, and so it is able to dispatch the method call to self.image_engine or self.video_engine, respectively. But it lacks that context in the fill filter function.
Having the base video engine extend the PIL engine causes failures elsewhere. The solution might be to have certain methods default to using the image_engine. I'll take a closer look at this.
First I would like to thank you for your project!
I have a problem when I try to use the filter thumbor.filters.fill. For some reason it doesn't work. When I go back to using the default engine, the filter works without problems.
I am using the minimalcompact/thumbor image, from hub.docker.com
Here's an example of what's happening
https://example.com/0x0:192x192/260x260/filters:still():format(jpeg):quality(10):fill(blue,1)/example.png
Here is the filter configuration of my container:
['thumbor_video_engine.filters.format','thumbor_video_engine.filters.still','thumbor.filters.fill',]
The log from container after access the URL
Thank you for your help! Best regards!