Problem/Motivation

@berdir noticed, in the UI, that it's possible to download custom sizes. It is indeed possible to do so just by specifying `w` and `h` in as query parameters (the predefined sized do the same). The api docs do not mention that though.

Proposed resolution

In the widget, add an option for `custum` as one of the Download sizes. If that is selected, show the width and height. Then generate the downlod url using that.

Remaining tasks

User interface changes

Proposed changes

API changes

Data model changes

CommentFileSizeAuthor
Screenshot from 2024-11-26 11-43-30.png30.77 KBprimsi
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

primsi created an issue. See original summary.

primsi’s picture

If this works fine, not sure if #3376719: Implement image resizing to save space makes sense any more.

berdir’s picture

Status: Active » Needs work

No, it does not. But lets test this a bit, specifically with different aspect images of original images. The UI always calculates the other value from the one you change dynamically. We likely need to do this as well to get a valid size based on the original aspect ratio? we do not want to change that.

Do we have the width/height of the original image in the metadata?

I wrote this for the image_resize project: https://git.drupalcode.org/project/image_resize/-/blob/1.x/src/SizeCalcu...

we'll need to decide and define if the sizes you configure are upper or lower bound, meaning if it should be at least as big or not bigger than.

If the API handles that then great and this is fine.

primsi’s picture

Status: Needs work » Needs review

Seems like fit=max being passed as one of the query arguments works fine if we want to ensure the image is inside the defined dimensions.

  • primsi committed 14b54edd on 1.x
    Issue #3489842 by primsi, berdir: Provide a way to download custom size
    
primsi’s picture

Status: Needs review » Fixed

Rebased. Now merging this.

Thx.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.