Skip to content

Commit

Permalink
Built release for 0.5.3. For a full change log look at the notes with…
Browse files Browse the repository at this point in the history
…in the original/0.5.3 release.
  • Loading branch information
github-actions[bot] committed Apr 9, 2024
1 parent 354b42d commit 964c11d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"owner":"humanmade","repo":"smart-media","sha":"28890d7eece42ff6cafee482ed57fd529e36c6d4","ref":"refs/tags/0.5.2","tagName":"0.5.2","branch":"gh-actions","tags":["0.5.2"],"updated_at":"2024-04-03T12:52:32.166Z"}
{"owner":"humanmade","repo":"smart-media","sha":"a4746bf63287998b1b8ffc10966876e240219471","ref":"refs/tags/0.5.3","tagName":"0.5.3","branch":"gh-actions","tags":["0.5.3"],"updated_at":"2024-04-09T09:03:44.323Z"}
16 changes: 14 additions & 2 deletions inc/cropper/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,11 @@ function src_get_dimensions( $dimensions, $image_src, $image_meta ) {
*
* @return string Converted 'img' element with 'srcset' and 'sizes' attributes added.
*/
function add_width_and_height_attr( string $image, array $image_meta ) : string {
function add_width_and_height_attr( $image, $image_meta ) : string {
if ( empty( $image_meta ) ) {
return $image;
}

$image_src = preg_match( '/src="([^"]+)"/', $image, $match_src ) ? $match_src[1] : '';

// Return early if we couldn't get the image source.
Expand Down Expand Up @@ -1061,7 +1065,15 @@ function add_width_and_height_attr( string $image, array $image_meta ) : string
*
* @return string Converted 'img' element with 'srcset' and 'sizes' attributes added.
*/
function add_srcset_and_sizes_attr( string $image, array $image_meta, int $attachment_id ) : string {
function add_srcset_and_sizes_attr( $image, $image_meta, $attachment_id ) : string {
if ( empty( $image_meta ) ) {
$image_meta = wp_get_attachment_metadata( $attachment_id );
}

if ( empty( $image_meta ) ) {
return $image;
}

$image_src = preg_match( '/src="([^"]+)"/', $image, $match_src ) ? $match_src[1] : '';

// Return early if we couldn't get the image source.
Expand Down

0 comments on commit 964c11d

Please sign in to comment.