Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion src/admin/class-meta-box.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ function cimo_get_media_type_label( $mimetype ) {
$converted_format_raw = isset( $cimo['convertedFormat'] ) ? $cimo['convertedFormat'] : ( isset( $post->post_mime_type ) ? $post->post_mime_type : '' );
$converted_format = $converted_format_raw ? cimo_convert_mimetype_to_format( $converted_format_raw ) : '';
$media_type_label = cimo_get_media_type_label( $converted_format_raw );
$is_image_media = is_string( $converted_format_raw ) && strpos( strtolower( $converted_format_raw ), 'image/' ) === 0;
$converttime = isset( $cimo['conversionTime'] ) ? floatval( $cimo['conversionTime'] ) : null;
if ( $converttime !== null ) {
if ( $converttime < 1000 ) {
Expand Down Expand Up @@ -207,7 +208,9 @@ function cimo_get_media_type_label( $mimetype ) {
echo '<li class="cimo-bulk-optimization-number">';
echo '🏞️ ' . sprintf(
/* translators: %s: bulk optimization count */
esc_html__( '%s thumbnail(s) processed', 'cimo-image-optimizer' ),
$is_image_media
? esc_html__( '%s thumbnail(s) processed', 'cimo-image-optimizer' )
: esc_html__( '%s file(s) processed', 'cimo-image-optimizer' ),
'<span class="cimo-value">' . esc_html( $bulk_optimization_count ) . '</span>'
);
echo '</li>';
Expand Down
3 changes: 2 additions & 1 deletion src/admin/js/media-manager/sidebar-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ function injectCimoMetadata( {

const convertedFormatRaw = customMetadata.convertedFormat || model.get( 'mime' ) || ''
const mediaTypeLabel = getMediaTypeLabel( convertedFormatRaw )
const isImageMedia = typeof convertedFormatRaw === 'string' && convertedFormatRaw.startsWith( 'image/' )

let html = `
<div class="cimo-media-manager-metadata-title-container">
Expand Down Expand Up @@ -185,7 +186,7 @@ function injectCimoMetadata( {
if ( isBulkOptimized ) {
html += `
<li class="cimo-bulk-optimization-number">
🏞️ <span class="cimo-value">${ escape( Object.keys( customMetadata.bulk_optimization ).length.toString() ) }</span> thumbnail(s) processed
🏞️ <span class="cimo-value">${ escape( Object.keys( customMetadata.bulk_optimization ).length.toString() ) }</span> ${ escape( isImageMedia ? 'thumbnail(s) processed' : 'file(s) processed' ) }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Emoji still image-specific for non-image media.

The 🏞️ (landscape) emoji prefix remains for video/audio too, which visually contradicts the new "file(s) processed" label. Consider a neutral icon (e.g., 📦 or 🎞️/🎵 by media type) when !isImageMedia.

Also note: the literal strings 'thumbnail(s) processed' and 'file(s) processed' bypass __() i18n (unlike the PHP counterpart which uses esc_html__). Pre-existing pattern nearby, but worth aligning for translators.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/admin/js/media-manager/sidebar-info.js` at line 189, Replace the
hardcoded 🏞️ emoji and literal strings with a neutral or media-aware icon and
proper i18n calls: use the existing isImageMedia boolean to choose an emoji
(e.g., '🏞️' for images, '🎞️' for video, '🎵' for audio or a neutral '📦' when
unknown) and wrap the label text in the translation helper (use the same JS i18n
function pattern used elsewhere) instead of the raw `'thumbnail(s) processed'` /
`'file(s) processed'`; update the template expression that references
customMetadata.bulk_optimization and escape(...) so it outputs the chosen icon
and translated label while preserving the existing escape(...) usage and
semantics.

</li>
<li class="cimo-bulk-optimization-number">
⚡️ Bulk optimized
Expand Down
2 changes: 1 addition & 1 deletion src/shared/converters/image-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class ImageConverter extends Converter {
return {
file,
metadata: null,
reason: 'resulting-image-bigger-than-input',
reason: 'resulting-media-bigger-than-input',
error: `Resulting image is bigger than the input (input: ${ file.size } bytes, output: ${ convertedBlob.size } bytes), skipping conversion.`,
}
}
Expand Down
Loading