Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass EXIF Data to the wp_read_image_metadata filter #904 #1020

Merged
merged 5 commits into from Aug 25, 2022
Merged

Pass EXIF Data to the wp_read_image_metadata filter #904 #1020

merged 5 commits into from Aug 25, 2022

Conversation

viktorix
Copy link
Member

Description

Changeset 43750 passes EXIF Data to the wp_read_image_metadata filter and changeset 43749 fixes a merge conflict by replacing sourceImageType with image_type.

Motivation and context

Fixes ClassicPress/ClassicPress-v1#38. See ticket ticket 43624 for details.

How has this been tested?

A quick way to test it is to add the following code to your functions.php. Make sure to upload a photo with exif data and replace the file path in the code. Load the website, it should show you exif data and the word "Yes!". See screenshot below.

add_action( 'wp_read_image_metadata', 'exif_data', 10, 5 );
function exif_data( $meta, $file, $image_type, $iptc = null, $exif = null ) {
		// If there is no Exif Version set return.
		if ( $exif['ExifVersion'] ) {
			$meta['test_filter'] = 'Yes!';
		}else{
			$meta['test_filter'] = 'No!';
		}
               return $meta;
}

require_once ABSPATH . '/wp-admin/includes/image.php';
$path = ABSPATH . '/wp-content/uploads/2022/06/PXL_20220611_200452520-Small.jpg';
wp_die(var_dump(wp_read_image_metadata( $path )));

Screenshots

image

Types of changes

Backport

@bahiirwa
Copy link
Collaborator

With just the changes to add wp- to the version numbers in function docblock. All is in order.

@bahiirwa bahiirwa added this to the 1.5.0-rc1 milestone Jun 25, 2022
@bahiirwa bahiirwa added status: has pr This change has been started in a PR. type: wp backport Related to backporting changes from WordPress. and removed status: has pr This change has been started in a PR. labels Jun 25, 2022
@bahiirwa bahiirwa added the task: needs 2nd review One member has reviewed this. Need a 2nd review to complete. label Jul 14, 2022
Updated @SInCE to include WP- reference.
@viktorix
Copy link
Member Author

@since blocks have been updated to include WP- reference.

Copy link
Member

@xxsimoxx xxsimoxx left a comment

Choose a reason for hiding this comment

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

image

@bahiirwa bahiirwa self-requested a review August 25, 2022 15:31
Copy link
Collaborator

@bahiirwa bahiirwa left a comment

Choose a reason for hiding this comment

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

Look good even after the whitespace. Same result as Simone.

@mattyrob mattyrob merged commit 884b4bc into ClassicPress:develop Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task: needs 2nd review One member has reviewed this. Need a 2nd review to complete. type: wp backport Related to backporting changes from WordPress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass EXIF Data to the wp_read_image_metadata filter
5 participants