FEATURE: automatically downsize large images#1
FEATURE: automatically downsize large images#1hussam789 wants to merge 1 commit intoimage-processing-optimizationfrom
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
User description
PR #1
PR Type
Enhancement
Description
Automatically downsize large images to allowed size during upload
Refactor OptimizedImage methods to use unified dimensions format
Increase client-side upload limit to 10MB for better UX
Add retry logic for image downsizing with up to 5 attempts
Diagram Walkthrough
File Walkthrough
uploads_controller.rb
Add automatic image downsizing on uploadapp/controllers/uploads_controller.rb
SiteSetting.max_image_size_kbto 10MBexceeding max allowed size
configured limit
optimized_image.rb
Refactor image optimization methods for consistencyapp/models/optimized_image.rb
resizeanddownsizemethods to format dimensions as stringbefore passing to
optimizedownsizemethod overload accepting pre-formatted dimensionsstring
optimizemethod to accept dimensions as single stringparameter
dimensionshelper method as formatting is now done inlineutilities.js
Increase client-side upload size limit to 10MBapp/assets/javascripts/discourse/lib/utilities.js
setting
10MB limit
downsizing