[wp-trac] [WordPress Trac] #27573: Don't re-upload album covers that already exist
WordPress Trac
noreply at wordpress.org
Fri Mar 28 23:07:38 UTC 2014
#27573: Don't re-upload album covers that already exist
----------------------------+--------------------
Reporter: wonderboymusic | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.9
Component: Media | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses:
----------------------------+--------------------
Comment (by GregLone):
Erf, I was about to post almost the same thing -_-'
The difference is I used a filter before the thumbnail creation, so
plugins can add a title to the attachment if they want (track title? album
title?).
{{{
/**
* Filter the parameters for the attachment thumbnail creation.
*
* @since 3.9.0
*
* @param array $attachment An array of parameters to create the
thumbnail.
* @param array $metadata Current attachment metadata.
* @param array $uploaded An array containing the thumbnail path and
url.
*/
$attachment = apply_filters( 'attachment_thumbnail_args', $attachment,
$metadata, $uploaded );
$sub_attachment_id = wp_insert_attachment( $sub_attachment,
$uploaded['file'] );
}}}
Also, I used a post meta to store the hash, but ''post_content_filtered''
seems to be better. Less easy to get but we won't use it every day.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27573#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list