Skip to content

Commit

Permalink
Jetpack plugin - Story Block: Fix 'Division by zero' Fatal (#39577)
Browse files Browse the repository at this point in the history
* Jetpack plugin - Story Block: Fix 'Division by zero' Fatal
  • Loading branch information
fgiannar authored Sep 30, 2024
1 parent c837623 commit 1fbc7a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Jetpack plugin - Story Block: Fix 'Division by zero' Fatal
7 changes: 6 additions & 1 deletion projects/plugins/jetpack/extensions/blocks/story/story.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,12 @@ class="wp-block-jetpack-story_image wp-story-image %3$s"
* @return string The CSS class which will display a cropped image
*/
function get_image_crop_class( $width, $height ) {
$crop_class = '';
$crop_class = '';
$width = (int) $width;
$height = (int) $height;
if ( ! $width || ! $height ) {
return $crop_class;
}
$media_aspect_ratio = $width / $height;
$target_aspect_ratio = EMBED_SIZE[0] / EMBED_SIZE[1];
if ( $media_aspect_ratio >= $target_aspect_ratio ) {
Expand Down

0 comments on commit 1fbc7a2

Please sign in to comment.