feat: add aspect ratio control for Feedzy Classic Block#1117
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds aspect ratio functionality to the thumbnail image control in the Feedzy RSS feeds plugin, allowing users to control how images are displayed with various aspect ratio options instead of relying only on fixed dimensions.
Key changes:
- Adds new aspect ratio selector control with predefined options (Original, 1:1, 16:9, 4:3, 3:2, 2:1, 3:4)
- Updates both block editor and frontend rendering to use CSS aspect-ratio property
- Replaces background-image spans with proper img elements for better accessibility
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| js/FeedzyBlock/inspector.js | Adds SelectControl for aspect ratio with predefined options |
| js/FeedzyBlock/attributes.js | Defines aspectRatio attribute with default value 'auto' |
| js/FeedzyBlock/Editor.js | Implements aspect ratio handler and updates editor rendering to use img elements |
| includes/gutenberg/feedzy-rss-feeds-gutenberg-block.php | Registers aspectRatio attribute for the block |
| includes/abstract/feedzy-rss-feeds-admin-abstract.php | Updates frontend rendering to apply aspect ratio styles and use img elements |
880b755 to
ee1fe1c
Compare
|
Plugin build for 1974b4c is ready 🛎️!
Note You can preview the changes in the Playground |
| // thumbs pixel size. | ||
| 'size' => '', | ||
| // default aspect ratio for the image. | ||
| 'aspectRatio' => 'auto', |
There was a problem hiding this comment.
let's make it '1'
| $img_style = ''; | ||
| if ( isset( $sizes['height'] ) ) { | ||
| $img_style = 'height:' . $sizes['height'] . 'px;'; | ||
| if ( isset( $sc['aspectRatio'] ) ) { |
There was a problem hiding this comment.
if the aspectRatio is '1' let's keep the backward compatibility by providing the width.
if ( isset( $sc['aspectRatio'] ) && '1' !== $sc['aspectRatio'] ) {| if ( isset( $sc['aspectRatio'] ) ) { | ||
| $img_style .= 'aspect-ratio:' . $sc['aspectRatio'] . ';'; | ||
| } elseif ( isset( $sizes['width'] ) && is_numeric( $sizes['width'] ) ) { | ||
| $img_style .= 'width:' . $sizes['width'] . 'px;'; | ||
| } |
There was a problem hiding this comment.
Should not be duplicated
0fb37d2 to
1974b4c
Compare
|
🎉 This PR is included in version 5.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Added Aspect Ratio Options and Better Dimension Handling for thumbnail image control.
Inspired by WordPress Aspect Ratio's design.
Will affect visual aspect of the product
YES
Screenshots
Editor
Preview
Test instructions
Check before Pull Request is ready:
Closes https://github.com/Codeinwp/feedzy-rss-feeds-pro/issues/883