diff --git wp-admin/includes/image.php wp-admin/includes/image.php
index 4d9e076..6cf8502 100644
--- wp-admin/includes/image.php
+++ wp-admin/includes/image.php
@@ -73,15 +73,20 @@ function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $s
  * @param string $file Filepath of the Attached image.
  * @return mixed Metadata for attachment.
  */
-function wp_generate_attachment_metadata( $attachment_id, $file ) {
+function wp_generate_attachment_metadata( $attachment_id, $file, $dimensions = false ) {
 	$attachment = get_post( $attachment_id );
 
 	$metadata = array();
 	$support = false;
-	if ( preg_match('!^image/!', get_post_mime_type( $attachment )) && file_is_displayable_image($file) ) {
-		$imagesize = getimagesize( $file );
-		$metadata['width'] = $imagesize[0];
-		$metadata['height'] = $imagesize[1];
+	if ( preg_match( '!^image/!', get_post_mime_type( $attachment ) ) && ( file_is_displayable_image( $file ) || $dimensions ) ) {
+		if( ! $dimensions ) {
+			$imagesize = getimagesize( $file );
+			$metadata['width'] = $imagesize[0];
+			$metadata['height'] = $imagesize[1];
+		} else {
+			$metadata['width'] = $dimensions['width'];
+			$metadata['height'] = $dimensions['height'];
+		}
 
 		// Make the file path relative to the upload dir.
 		$metadata['file'] = _wp_relative_upload_path($file);
