Skip to content

Commit 0d37e1a

Browse files
committed
Merge branch 'mrtango-classic-ui-images' of https://github.com/plone/documentation into mrtango-classic-ui-images
2 parents 99d177c + 58481e4 commit 0d37e1a

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

docs/classic-ui/images.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,15 @@ To get the scaling information only without creating an HTML tag, you can use th
107107
from plone import api
108108

109109
scale_util = api.content.get_view("images", context, request)
110+
<<<<<<< HEAD
110111
# on the following line "image" is the field name.
111112
# The default Image content types field name is "image".
112113
image_scale = scale_util.scale("image", scale="mini")
114+
=======
115+
# The default `Image` content type's field name is "image".
116+
# On the following line of code, "leadimage" is the field name.
117+
image_scale = scale_util.scale("leadimage", scale="mini")
118+
>>>>>>> 58481e400f28d62b1ad48bdf33572b2710c6f81c
113119
print(image_scale.url)
114120
print(image_scale.width)
115121
print(image_scale.height)
@@ -144,7 +150,7 @@ You can directly create an HTML tag from `image_scale`:
144150
<img src="http://localhost:8080/Plone/news/newsitem1/@@images/9f676d46-0cb3-4512-a831-a5db4079bdfa.jpeg" alt="News Item 1!" title="News Item 1" height="21" width="32" srcset="http://localhost:8080/Plone/news/newsitem1/@@images/4a68513c-cffd-4de0-8a35-80627945b80f.jpeg 2x, http://localhost:8080/Plone/news/newsitem1/@@images/c32929c6-cb89-4ce7-846f-38adf29c09a4.jpeg 3x" />
145151
```
146152

147-
Instead of using the configured named scales you can also get an HTML tag with any specific size in pixels:
153+
Instead of using the configured named scales, you can get an HTML tag with any specific size in pixels:
148154

149155
```python
150156
from plone import api
@@ -205,23 +211,42 @@ image_scale = scaling_util.publishTraverse(context.REQUEST, groups[1])
205211

206212
(classic-ui-images-scaling-direction-deprecated-in-favor-of-label)=
207213

214+
<<<<<<< HEAD
208215
## Scaling `direction`
209216

210217
The default direction is `thumbnail`.
218+
=======
219+
## Scaling `direction` to be deprecated in favor of `mode`
220+
221+
```{attention}
222+
In the upcoming release of Plone 6.0, in `plone.scale` the `direction` argument will be deprecated in favor of `mode`.
223+
224+
`plone.scale` will continue to do scaling, but the values should be converted in your code as follows:
225+
>>>>>>> 58481e400f28d62b1ad48bdf33572b2710c6f81c
211226
212227
Other options are:
213228
229+
<<<<<<< HEAD
214230
* scale-crop-to-fit
215231
* down
216232
* scale-crop-to-fill
217233
* up
218234
* keep
219235
* thumbnail
236+
=======
237+
Until the final release of Plone 6.0, continue to use `plone.namedfile` with the `direction` argument and its values.
238+
```
239+
>>>>>>> 58481e400f28d62b1ad48bdf33572b2710c6f81c
220240
221241

222242
(classic-ui-images-permissions-label)=
223243

224244
## Permissions
225245

226246
The `ImageScaling` view explicitly checks the permissions of the current user.
247+
<<<<<<< HEAD
227248
To access image scales which are normally not accessible to the current user, override the `validate_access` method in `plone.namedfile.scaling.ImageScale`.
249+
=======
250+
To access image scales, which are normally not accessible to the current user, override the `validate_access` method in `plone.namedfile.scaling.ImageScale`.
251+
In `Products.EasyNewsletter` you can find an example of that.
252+
>>>>>>> 58481e400f28d62b1ad48bdf33572b2710c6f81c

0 commit comments

Comments
 (0)