PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.3
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.3
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / vendor / intervention / image / src / Intervention / Image / Commands / ExifCommand.php

ExifCommand.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.3, at vendor/intervention/image/src/Intervention/Image/Commands/ExifCommand.php

62 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Intervention\Image\Commands;
4
5 use Intervention\Image\Exception\NotReadableException;
6 use Intervention\Image\Exception\NotSupportedException;
7
8 class ExifCommand extends AbstractCommand
9 {
10 /**
11 * Read Exif data from the given image
12 *
13 * Note: Windows PHP Users - in order to use this method you will need to
14 * enable the mbstring and exif extensions within the php.ini file.
15 *
16 * @param \Intervention\Image\Image $image
17 * @return boolean
18 */
19 public function execute($image)
20 {
21 if (!function_exists('exif_read_data')) {
22 throw new NotSupportedException(
23 "Reading Exif data is not supported by this PHP installation."
24 );
25 }
26
27 $key = $this->argument(0)->value();
28
29 // try to read exif data from image file
30 try {
31 if ($image->dirname && $image->basename) {
32 $stream = $image->dirname . '/' . $image->basename;
33 } elseif (version_compare(PHP_VERSION, '7.2.0', '>=')) {
34 // https://www.php.net/manual/en/function.exif-read-data.php#refsect1-function.exif-read-data-changelog
35 $stream = $image->stream()->detach();
36 } else {
37 // https://bugs.php.net/bug.php?id=65187
38 $stream = $image->encode('data-url')->encoded;
39 }
40
41 $data = @exif_read_data($stream);
42
43 if (!is_null($key) && is_array($data)) {
44 $data = array_key_exists($key, $data) ? $data[$key] : false;
45 }
46
47 } catch (\Exception $e) {
48 throw new NotReadableException(
49 sprintf(
50 "Cannot read the Exif data from the filename (%s) provided ",
51 $image->dirname . '/' . $image->basename
52 ),
53 $e->getCode(),
54 $e
55 );
56 }
57
58 $this->setOutput($data);
59 return true;
60 }
61 }
62