Skip to content
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

ImageScale vs ImageScaling #160

Open
gforcada opened this issue Jul 8, 2024 · 1 comment
Open

ImageScale vs ImageScaling #160

gforcada opened this issue Jul 8, 2024 · 1 comment

Comments

@gforcada
Copy link
Member

gforcada commented Jul 8, 2024

Context

I'm reading the excellent docs ✨ (thanks @plone/documentation-team 💯 ) and I noticed that when talking about the srcset it does not explicitly mentions what's the actual python API method you should use (I will try to provide a fix for the docs later)...

Issue

So, I opened GitHub and looked at plone/namedfile/scaling.py where I found 2 classes:

  • ImageScale
  • ImageScaling

With almost exact docstrings:

  • view used for generating (and storing) image scales
  • view used for rendering image scales

Little quiz: which docstring belongs to which class? 🙃

Anyway, they look way too similar to not merge them, deprecate one, or... ? 🤔

@mauritsvanrees
Copy link
Member

ImageScaling is the @@images view. It generates or gets a scale (so an actual blob file and metadata). And then it passes this info on to the ImageScale class, which can then be downloaded or show a tag.

So ImageScaling does the scaling, and ImageScale is the scale. Simple! :-D Well... perhaps not.

But they do have different purposes, and they are both quite long, so it is probably better to keep them separate.

I sometimes do have the urge to completely redo this package plus plone.scale. Maybe after my pension. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants