WordPress.org

Ready to get started?Download WordPress

Forums

Request for monochrom JPEG image handling (1 post)

  1. yasuaki327
    Member
    Posted 5 years ago #

    WordPress does not handle monochrome JPEG image correctory. This restriction is described in "file_is_displayable_image() function at /wp-admin/includes/image.php".

    WordPress will not create meta data information for monochrom JPEG images.
    This behavior brings some serious troubles in '[gallery]' shortcode thumbnails.

    Most of modern WEB browsers can display monochrom JPEG images, please remove this restriction.

    [/wp-admin/includes/image.php]

    // is the file an image suitable for displaying within a web page?
    function file_is_displayable_image($path) {
    	$info = @getimagesize($path);
    	if ( empty($info) )
    		$result = false;
    	elseif ( !in_array($info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) )
    		// only gif, jpeg and png images can reliably be displayed
    		$result = false;
    	elseif ( $info['channels'] > 0 && <strong><em>$info['channels'] != 3</em></strong> ) {
    		// some web browsers can't display cmyk or grayscale jpegs
    		$result = false;
    	}
    	else
    		$result = true;
    
    	return apply_filters('file_is_displayable_image', $result, $path);
    }

Topic Closed

This topic has been closed to new replies.

About this Topic