mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-13 00:54:34 +00:00
Media: revert the multi-mime feature.
This feature isn't quite ready to land. Reverts r53786, r53848, r53847, r53845, r53751. Props flixos90, azaozz, dd32. See #55443. git-svn-id: https://develop.svn.wordpress.org/trunk@54085 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -334,11 +334,6 @@ abstract class WP_Image_Editor {
|
||||
protected function get_output_format( $filename = null, $mime_type = null ) {
|
||||
$new_ext = null;
|
||||
|
||||
// If no mime type is passed but output mime type is set, use that.
|
||||
if ( ! $mime_type && ! empty( $this->output_mime_type ) ) {
|
||||
$mime_type = $this->output_mime_type;
|
||||
}
|
||||
|
||||
// By default, assume specified type takes priority.
|
||||
if ( $mime_type ) {
|
||||
$new_ext = $this->get_extension( $mime_type );
|
||||
@@ -430,25 +425,18 @@ abstract class WP_Image_Editor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an output filename based on current file, and adding proper suffix.
|
||||
* Builds an output filename based on current file, and adding proper suffix
|
||||
*
|
||||
* @since 3.5.0
|
||||
* @since 6.1.0 Skips adding a suffix when set to an empty string. When the
|
||||
* file extension being generated doesn't match the image file extension,
|
||||
* add the extension to the suffix
|
||||
*
|
||||
* @param string $suffix Optional. Suffix to add to the filename. The default null
|
||||
* will result in a 'widthxheight' suffix. Passing
|
||||
* an empty string will result in no suffix.
|
||||
* @param string $dest_path Optional. The path to save the file to. The default null
|
||||
* will use the image file path.
|
||||
* @param string $extension Optional. The file extension to use. The default null
|
||||
* will use the image file extension.
|
||||
* @return string filename The generated file name.
|
||||
* @param string $suffix
|
||||
* @param string $dest_path
|
||||
* @param string $extension
|
||||
* @return string filename
|
||||
*/
|
||||
public function generate_filename( $suffix = null, $dest_path = null, $extension = null ) {
|
||||
// $suffix will be appended to the destination filename, just before the extension.
|
||||
if ( null === $suffix ) {
|
||||
if ( ! $suffix ) {
|
||||
$suffix = $this->get_suffix();
|
||||
}
|
||||
|
||||
@@ -469,21 +457,7 @@ abstract class WP_Image_Editor {
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $suffix ) ) {
|
||||
$suffix = '';
|
||||
} else {
|
||||
$suffix = "-{$suffix}";
|
||||
}
|
||||
|
||||
// When the file extension being generated doesn't match the image file extension,
|
||||
// add the extension to the suffix to ensure a unique file name. Prevents
|
||||
// name conflicts when a single image type can have multiple extensions,
|
||||
// eg. .jpg, .jpeg and .jpe are all valid JPEG extensions.
|
||||
if ( ! empty( $extension ) && $extension !== $ext ) {
|
||||
$suffix .= "-{$ext}";
|
||||
}
|
||||
|
||||
return trailingslashit( $dir ) . "{$name}{$suffix}.{$new_ext}";
|
||||
return trailingslashit( $dir ) . "{$name}-{$suffix}.{$new_ext}";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -663,28 +637,5 @@ abstract class WP_Image_Editor {
|
||||
|
||||
return wp_get_default_extension_for_mime_type( $mime_type );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the editor output mime type, useful when outputting alternate mime types.
|
||||
*
|
||||
* Track that the mime type is set with the mime type set flag.
|
||||
*
|
||||
* @since 6.1.0
|
||||
*
|
||||
* @param string $output_mime_type The mime type to set.
|
||||
*/
|
||||
public function set_output_mime_type( $output_mime_type ) {
|
||||
$this->output_mime_type = $output_mime_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the mime type to the original file mime type.
|
||||
*
|
||||
* Reset the mime type set flag.
|
||||
*
|
||||
* @since 6.1.0
|
||||
*/
|
||||
public function reset_output_mime_type() {
|
||||
$this->output_mime_type = $this->mime_type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user