Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions mr-image-resize.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ function mr_image_resize($url, $width=null, $height=null, $crop=true, $align='c'
$metadata = wp_get_attachment_metadata($get_attachment[0]->ID);
if (isset($metadata['image_meta'])) {
$md = $saved['width'] . 'x' . $saved['height'];
if ($crop) $md .= ($align) ? "_${align}" : "_c";
if ($crop) {
$md .= ($align) ? '_' . $align : '_c';
}
$metadata['image_meta']['resized_images'][] = $md;
wp_update_attachment_metadata($get_attachment[0]->ID, $metadata);
}
Expand Down Expand Up @@ -203,15 +205,15 @@ function mr_common_info($url, $width, $height, $crop, $align, $retina) {
$name = wp_basename($file_path, ".$ext");

// Suffix applied to filename
$suffix = "${dest_width}x${dest_height}";
$suffix = $dest_width . 'x' . $dest_height;

// Set align info on file
if ($crop) {
$suffix .= ($align) ? "_${align}" : "_c";
$suffix .= ($align) ? '_' . $align : '_c';
}

// Get the destination file name
$dest_file_name = "${dir}/${name}-${suffix}.${ext}";
$dest_file_name = $dir . '/' . $name . '-' . $suffix . '.' . $ext;

// Return info
return array(
Expand Down Expand Up @@ -258,4 +260,4 @@ function mr_delete_resized_images($post_id) {

}

}
}