Skip to content

Use Imagick methods instead of mogrify() for repo theme images - #2375

Open
sbreker wants to merge 4 commits into
qa/2.xfrom
dev/repo-logo-use-imagick
Open

Use Imagick methods instead of mogrify() for repo theme images#2375
sbreker wants to merge 4 commits into
qa/2.xfrom
dev/repo-logo-use-imagick

Conversation

@sbreker

@sbreker sbreker commented Jun 27, 2026

Copy link
Copy Markdown
Member

Refactored class arRepositoryThemeCropValidatedFile to use Imagick methods instead of mogrify command.

Replace the previous crop-only behavior with resize-and-crop processing for repository logo and banner uploads. Images are now scaled to cover the target dimensions while preserving aspect ratio, then center-cropped to the final logo or banner size. This keeps uploaded assets small after processing and avoids squashing non-square source images. Also increased the allowed upload size from 256K to 500K to give users more room to upload larger source images before resize and crop.

Set Imagick memory, map, and pixel-area limits before reading repository logo and banner uploads.

@sbreker
sbreker force-pushed the dev/repo-logo-use-imagick branch 3 times, most recently from 8dc8e44 to 3869a0a Compare June 27, 2026 01:28
Comment on lines +97 to +100
protected function shouldCropImages()
{
return extension_loaded('imagick');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of defining this method, could we just re-use QubitDigitalObject::imagickExtensionLoaded since that is a static method?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea - I have updated this to use the static method 👍

sbreker added 3 commits July 16, 2026 15:28
Refactored class arRepositoryThemeCropValidatedFile to use Imagick
methods instead of mogrify() command.
Replace the previous crop-only behavior with resize-and-crop processing
for repository logo and banner uploads. Images are now scaled to cover
the target dimensions while preserving aspect ratio, then center-cropped
to the final logo or banner size.

This keeps uploaded assets small after processing and avoids squashing
non-square source images.

Also increased the allowed upload size from 256K to 500K to give users
more room to upload larger source images before resize and crop.
Set Imagick memory, map, and pixel-area limits before reading
repository logo and banner uploads.
@sbreker
sbreker force-pushed the dev/repo-logo-use-imagick branch from 3869a0a to 333640d Compare July 16, 2026 22:28
Use QubitDigitalObject::imagickExtensionLoaded().
@sbreker
sbreker requested a review from anvit July 16, 2026 22:37
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

Successfully merging this pull request may close these issues.

2 participants