You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
The image_style function of utils/media.py is responsible for generating image styles.
It currently utilises the linux file name conventions explicitly, which makes this function unavailable to Windows.
Also, the way that the paths are constructed is not Pythonic and causes trouble to the tests in #44 as the media root there is different than as assumed in most projects.
Method:
Instead of passing the url string pass the ImageField object itself in order to use the file property (instead of the url property that was used in templates).
Then return the appropriate url.
Also change the templatetags to remove the @stringfilter and the variable names to reflect the change.
Consequently, the image_style_form template tag is now obsolete. This was totally unnecessary anyway, the initial reasoning was that form imagefields are different objects but the ImageField object can be obtained from them.
Change the block_static.html example template from <img src="{{ img.image.url|image_style:'large' }}"> to <img src="{{ img.image|image_style:'large' }}">
Change the templates stacked.html that displays thumbnails in node editing from <img src="{{ inline_admin_form.form.image.value|image_style_form:'thumbnail' }}"> to <img src="{{ inline_admin_form.form.image.value|image_style:'thumbnail' }}"> (the value property is the underlying model ImageField in the form ImageField).
Update CHANGELOG and make note that when updating 9cms, this is requires manual updates to all templates using images styles.
The text was updated successfully, but these errors were encountered:
The
image_style
function ofutils/media.py
is responsible for generating image styles.It currently utilises the linux file name conventions explicitly, which makes this function unavailable to Windows.
Also, the way that the paths are constructed is not Pythonic and causes trouble to the tests in #44 as the media root there is different than as assumed in most projects.
Method:
ImageField
object itself in order to use thefile
property (instead of theurl
property that was used in templates).@stringfilter
and the variable names to reflect the change.image_style_form
template tag is now obsolete. This was totally unnecessary anyway, the initial reasoning was that form imagefields are different objects but the ImageField object can be obtained from them.block_static.html
example template from<img src="{{ img.image.url|image_style:'large' }}">
to<img src="{{ img.image|image_style:'large' }}">
stacked.html
that displays thumbnails in node editing from<img src="{{ inline_admin_form.form.image.value|image_style_form:'thumbnail' }}">
to<img src="{{ inline_admin_form.form.image.value|image_style:'thumbnail' }}">
(thevalue
property is the underlying model ImageField in the form ImageField).The text was updated successfully, but these errors were encountered: