-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Add draft support to retrieve Exif from HEIF file #13443
base: master
Are you sure you want to change the base?
Conversation
Hey, @benstonezhang! |
47ccc3b
to
25308f6
Compare
@jorgsowa Is there any test about exif I can use as reference? I'm not family with php. |
@jorgsowa I added one test case for heif, please check. The image is just taken by my phone's camera. |
37bedca
to
c486673
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I will need to do a bit more research but initially it looks good except few smaller things that I commented on.
2e68a92
to
b7e94a3
Compare
Signed-off-by: Benstone Zhang <[email protected]>
b7e94a3
to
37b5208
Compare
I think the last missing piece is to add the entry to the |
Well this still needs a proper review. I have got it on my TODO list. It might take couple of weeks though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems I need to submit it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had quick look throught and it will still need some testing.
That said I'm actually wondering how useful this really is. There's actually related PR to add HEIF support for ext/gd: #14504 . Last comment from @cmb69 questioned the usefulness of HEIF support in GD. I'm actually wondering how much in use this is. I just shared some photos from my iphone (15 pro) and it gets always converted either to gif or jpg so it doesn't like new iPhones make it easy to get the images in the HEIF. Could you clarify the use case for this please?
@@ -4285,11 +4297,128 @@ static bool exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offs | |||
return result; | |||
} | |||
|
|||
static int exif_isobmff_parse_box(unsigned char *buf, isobmff_box_type *box) | |||
{ | |||
box->size = php_ifd_get32u(buf, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it supposed to be always little endian for heif?
item_count = php_ifd_get32u(p, 1); | ||
p += 4; | ||
} | ||
for (i=0, p2=p; i<item_count; i++, p2 += 16) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CS: missing spaces before and after =
and <
Please check you iphone "Settings -> Photos -> TRANSFER TO MAC OR PC -> Keep Originals". If you set is as "Automatic", all the photos will convert to JPG. |
Dropping in to provide a use case for this... As a media component maintainer for the WordPress project, I can add that we regularly get support requests from users who have HEIC image files on their computer and try to upload them to their WordPress site. I understand that iPhones can be set to copy files over as JPEG (and that might even be the default?) - nonetheless, HEIC images are widespread already and people do try to upload them to use on their sites. Until recently, WordPress would just throw an error when users uploaded these images. In this ticket we added support for converting these uploaded files into JPEG or WebP images, as long as the system has Imagick installed with HEIC support. If PHP's GD supported HEIF directly, we would able to provide this feature for those users as well.. |
Test passed on HEIC file retrieve from iPhoneSE3 and some pictures get from internet.
The attachments are patch files for version 8.1 and 8.2
php_8.1_exif_heif.patch
php_8.2_exif_heif.patch