Read EXIF data from HEIC photo using PHP - php

I want to read the EXIF data from a HEIC photo.
If I run:
<?php
var_dump(exif_read_data("test.heic"));
I get
bool(false)
If I run the Linux tool exiftool test.heic - then I can see all the information that I need is there (location, camera name, etc).
If I run exif_read_data("test.jpg") - then I get data. So I know the syntax I'm using is correct.
I'm using PHP 7.1 and ImageMagick 6.9.4-10 (1684).
print_r(imagick::getVersion());
Array
(
[versionNumber] => 1684
[versionString] => ImageMagick 6.9.4-10 Q16 x86_64 2017-05-23 http://www.imagemagick.org
)
Do I need newer versions? If so, which ones work with HEIC?

This is a limitation in the EXIF extension for PHP. Currently the EXIF extension will only read two file formats:
JPEG
TIFF
As the extension maintainer for EXIF in PHP, I cannot say that there is a specific plan to support more formats, as only recently one report has been posted at the bug tracker in regards to supporting PNG images (starting with version 1.5 of the PNG specification).
My suggestion to you is to report it as a "Feature Request" on the PHP bug tracker so it can be tracked (and if you can provide details or even an experimental implementation, it would help push this into PHP faster). For now the only option is to convert images into JPEG or TIFF to make them readable by the EXIF extension.

Related

How to upgrade the version of php-gd library when running from php-fpm at Ubuntu 16.04 server?

I've followed this tutorial to install and support PHP-5.6 at my ISPConfig3 server: https://www.howtoforge.com/tutorial/how-to-install-php-5-6-on-ubuntu-16-04/.
The installation is up and running, now I want to change the php-gd library version. PHP info actually reports:
GD Support enabled
GD Version bundled (2.1.0 compatible)
I need to use the following version:
GD Support enabled
GD headers Version 2.2.3
GD library Version 2.2.3
Why do i need to upgrade?
I'm facing problems when cropping images, but is only on this server. I've a similar server with PHP-5.6, without fpm, that is working fine. I realized the difference in versions after compare the phpinfo() reports from both servers
Expected Behavior
User uploads an image. The image can have any dimension. (eg: 1920x1080)
The script resizes the image. (eg: from 1920px to 1200px)
The resized image maintain it's original aspect ratio and should not be cropped.
See: http://imgur.com/MkMVg6x
The problem
User uploads an image. The image can have any dimension. (eg: 1920x1080)
The script SHOULD resize the image. (eg: from 1920px to 120px)
The final image was cropped erroneously :(
See: http://imgur.com/a/wT0Rh
Since i'm using php-fpm, how can i upgrade my GD library version?
After long hours digging, I finally found the problem, and as i expected, it's not related to GD library itself. It's related to phpThumb and imagemagick libraries.

imagick not converting webp format on Amazon Linux

imagick convert command is not working for this webp image -
https://lh3.googleusercontent.com/VRY0O_3L8VH2wxJSTiKPr72PeM5uhPPFEsHzzYdxenddpTI150M0TYpljnZisQaROR0=h256-rw -
convert -resize 50x50! https://lh3.googleusercontent.com/VRY0O_3L8VH2wxJSTiKPr72PeM5uhPPFEsHzzYdxenddpTI150M0TYpljnZisQaROR0=h256-rw /var/test_sandeepan/output.jpg
Output -
convert: no decode delegate for this image format `WEBP' # error/constitute.c/ReadImage/535.
From this, I conclude that webp is either not supported by Imagick at all, or not supported by this version.
A link shared in this answer, talks about webp support along with imagemagick and php, so I thought imagick must be supporting webp as well, because PHP imagemagick, as per my understanding is nothing but a wrapper class to the imagick utility. Please correct me if I am wrong here.
I conclude that webp is either not supported by Imagick at all, or not supported by this version.
Imagick doesn't really do anything. All it does is convert PHP function calls into C function calls, to call the ImageMagick code through its 'wand' API.
If you want to have ImageMagick support webp, you will either need to install a version that has been compiled with webp support compiled in, or compile it yourself: http://www.imagemagick.org/script/advanced-unix-installation.php
You'll need to install libwebp-devel either from apt/yum, or from https://github.com/webmproject/libwebp as ImageMagick relies on that 'delegate' code being there to read/write webp images.

ImageMagik Crop and GhostScript PHP v 5.3.13 and Apache v 2.3.33

I am trying to convert pdf file into jpeg image format using imagemagik crop and ghostscript.
I research a lot, but not getting any solution got so many links but my system compatiblity might be an issue.
My System is Win 7
PHP v 5.3.13
Apache v 2.3.33
wampserver2.2e-php5.3.13-httpd2.2.22-mysql5.5.24-32b
I am not getting any proper link where i can find out dll file and make such changes in .dll file etc.
If all you want is a JPEG then you can use Ghostscript directly to produce it. I can't see any reason why you would want to change a DLL, which realistically you can only do by changing and recompiling the source.
Eg:
http://stackoverflow.com/questions/13812998/ghostscript-ps-to-jpg-output-without-white-space

check for ghostscript support in php imagick?

is it possible to check the php imagick extension for ghostscript support?
for example if it is turned on / off, the ghostscript version used, etc.
which possibilities are there to get additional ghostscript / pdf details?
the only thing i've found so far is this (version of imagick lib itself):
http://php.net/manual/en/imagick.getversion.php
ps: no system calls are allowed (e.g. exec) from within php
I don't know much about imagick, but some things about imagemagick. My guess is that by reading this answer related to imagemagick could help you with imagick as well:
convert -list delegate | grep -Ei '(PDF|PS|EPS)'
(convert is one of the CLI utilities which are part of imagemagick.)

Best way to open,crop,rotate and convert a windowsbitmap (bmp)

I like to open a Windows bitmap file within php.
I found some piece of code (imagecreatefrombmp), that converts a bmp to png.
But that code is in plain php and to slow.
My images have a size around 1000x2000 pixels.
gdlib doesn't open bmp files.
IMagick to complicated to compile and i don't find windows binaries that work with my php.
Additional i like to open that bmp from a string.
it is streamed from a db.
I also need to do some rotations (0, 90, 180, 270) and some cropping.
Finally i like to save it to tiff or png file (or string).
But primary problem, how to open a bmp file?
plattform:
php 5.2 (vc6,ts) on Windows Cli and Apache 2.2 Module
zend framework 1.10
You can find precompiled gmagick PHP extension for Windows at valokuva site. The file is named php_gmagick_ts.dll.
The trick is that these are built using VC9 compiler so you will need VC9 version of Apache and PHP as well. If you plan to install PHP as a module, you will need a thread safe (ts) version of gmagick and PHP. You can get Apache built using VC9 from apachelounge, file named httpd-2.2.14-win32-x86-ssl.zip and PHP from PHP web site, file named php-5.3.1-Win32-VC9-x86.msi
gmagick code samples are available in the PHP documentation or in great tutorial at Zend DevZone.
To see all links for this answer go to http://www.google.com/notebook/public/11284522948259357138/BDQo5QwoQqbC67p4i
Enjoy!

Categories