Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #17200 > unrolled thread

prob with exec, exiftool and one photo

Started byUne Bévue <unbewusst.sein@fai.invalid>
First post2016-12-13 17:14 +0100
Last post2016-12-22 07:08 +0100
Articles 20 on this page of 31 — 8 participants

Back to article view | Back to comp.lang.php


Contents

  prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-13 17:14 +0100
    Re: prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-13 17:15 +0100
    Re: prob with exec, exiftool and one photo "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-12-13 17:28 +0100
      Re: prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-13 18:23 +0100
        Re: prob with exec, exiftool and one photo "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-12-14 00:19 +0100
    Re: prob with exec, exiftool and one photo "R.Wieser" <address@not.available> - 2016-12-13 18:03 +0100
      Re: prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-13 18:28 +0100
    Re: prob with exec, exiftool and one photo "J.O. Aho" <user@example.net> - 2016-12-13 23:42 +0100
      Re: prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-14 07:02 +0100
        Re: prob with exec, exiftool and one photo Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-14 17:37 +0100
          Re: prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-14 18:13 +0100
    [BADLY SOLVED]: prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-14 08:11 +0100
      Re: [BADLY SOLVED]: prob with exec, exiftool and one photo Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-14 17:43 +0100
        Re: [BADLY SOLVED]: prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-14 18:24 +0100
          Re: [BADLY SOLVED]: prob with exec, exiftool and one photo Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-14 19:57 +0100
        Re: [BADLY SOLVED]: prob with exec, exiftool and one photo "R.Wieser" <address@not.available> - 2016-12-14 19:01 +0100
          Re: [BADLY SOLVED]: prob with exec, exiftool and one photo Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-14 19:39 +0100
            Re: [BADLY SOLVED]: prob with exec, exiftool and one photo "R.Wieser" <address@not.available> - 2016-12-17 09:11 +0100
              Re: [BADLY SOLVED]: prob with exec, exiftool and one photo Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-17 09:33 -0500
          Re: [BADLY SOLVED]: prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-15 06:19 +0100
      Re: [BADLY SOLVED]: prob with exec, exiftool and one photo Eli the Bearded <*@eli.users.panix.com> - 2016-12-14 22:19 +0000
        Re: [BADLY SOLVED]: prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-15 06:30 +0100
        [UNSOLVABLE]: prob with exec, exiftool and one photo Une Bévue <unbewusst@fai.invalid> - 2016-12-17 08:08 +0100
          Re: [UNSOLVABLE]: prob with exec, exiftool and one photo "R.Wieser" <address@not.available> - 2016-12-17 09:26 +0100
            Re: [UNSOLVABLE]: prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-17 10:45 +0100
              Re: [UNSOLVABLE]: prob with exec, exiftool and one photo "R.Wieser" <address@not.available> - 2016-12-17 11:41 +0100
                Re: [UNSOLVABLE]: prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-17 17:39 +0100
                  Re: [UNSOLVABLE]: prob with exec, exiftool and one photo "R.Wieser" <address@not.available> - 2016-12-18 10:27 +0100
                    Re: [UNSOLVABLE]: prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-21 11:36 +0100
                      Re: [UNSOLVABLE]: prob with exec, exiftool and one photo "R.Wieser" <address@not.available> - 2016-12-21 16:58 +0100
                        Re: [UNSOLVABLE]: prob with exec, exiftool and one photo Une Bévue <unbewusst.sein@fai.invalid> - 2016-12-22 07:08 +0100

Page 1 of 2  [1] 2  Next page →


#17200 — prob with exec, exiftool and one photo

FromUne Bévue <unbewusst.sein@fai.invalid>
Date2016-12-13 17:14 +0100
Subjectprob with exec, exiftool and one photo
Message-ID<o2p6o9$pgl$1@shakotay.alphanet.ch>
Hey all,

I have a folder with photos :

$ ls -al '/Users/yt/Sites/tests/Flipping_image/photos/'
total 4848
drwxr-xr-x  10 yt  staff   340B 13 déc 09:46 .
drwxr-xr-x  10 yt  staff   340B 13 déc 07:48 ..
-rw-r--r--   1 yt  staff   1,1M 12 déc 10:01 20161202_085945.jpg
-rw-r--r--   1 yt  staff    66K 13 déc 08:10 Cirques.jpg
-rw-r--r--   1 yt  staff   662K 13 déc 08:27 Cirques.png
-rw-r--r--   1 yt  staff   541K  6 déc 13:43 IMG_3130.JPG

those photos have the same user and group and also the same rights 
'-rw-r--r--'.

i need to read exif infos from those files using the php script :

   $EXIFTOOL = '/usr/local/bin/exiftool';
   $cmd = "$EXIFTOOL " . $data['PATH'];
   exec($cmd, $Infos, $ExitStatus);
   foreach($Infos as $line) {
     $fields = explode(' : ', $line, 2 );
     if(count($fields) == 2) {
       $data[rtrim($fields[0])] = $fields[1];
     }
   }
   $data['ExitStatus'] = $ExitStatus;

for 3 of those photos :
Cirques.jpg
Cirques.png
IMG_3130.JPG

i get back the good exif infos, like :
{
   "ExifTool Version Number":  "10.20",
   "File Name":  "IMG_3130.JPG",
   "Directory":  "\/Users\/yt\/Sites\/tests\/Flipping_image\/photos",
   "File Size":  "541 kB",
   [...]
   "Hyperfocal Distance":  "1.82 m",
   "Light Value":  "4.0",
   "ExitStatus":  0
}

($data is send thru json_encode)

however for the photo '20161202_085945.jpg' the php script returns 
nothing even no error althought I'm able, on terminal to retrieve those 
datas :
$ /usr/local/bin/exiftool 
/Users/yt/Sites/tests/Flipping_image/photos/20161202_085945.jpg
ExifTool Version Number         : 10.20
File Name                       : 20161202_085945.jpg
Directory                       : 
/Users/yt/Sites/tests/Flipping_image/photos
File Size                       : 1128 kB
File Modification Date/Time     : 2016:12:12 10:01:18+01:00

[...]

Field Of View                   : 60.3 deg
Focal Length                    : 3.7 mm (35 mm equivalent: 31.0 mm)
Hyperfocal Distance             : 1.47 m


the only difference I see is the weight of this photo (1,1MB, the other 
being less than 0.7MB)

then i need some light in order to find what is broken here.

best,

YT

[toc] | [next] | [standalone]


#17201

FromUne Bévue <unbewusst.sein@fai.invalid>
Date2016-12-13 17:15 +0100
Message-ID<o2p6qt$pgl$2@shakotay.alphanet.ch>
In reply to#17200
I forgot to mention I'm working on macOS Sierra with PHP 5.6.25.

[toc] | [prev] | [next] | [standalone]


#17202

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2016-12-13 17:28 +0100
Message-ID<o2p7in$md4$1@solani.org>
In reply to#17200
On 13.12.2016 at 17:14, Une Bévue wrote:

> i need to read exif infos from those files using the php script :
> 
> […]
>
> however for the photo '20161202_085945.jpg' the php script returns
> nothing even no error althought I'm able, on terminal to retrieve those
> datas :
> $ /usr/local/bin/exiftool
> /Users/yt/Sites/tests/Flipping_image/photos/20161202_085945.jpg
> ExifTool Version Number         : 10.20
> File Name                       : 20161202_085945.jpg
> Directory                       :
> /Users/yt/Sites/tests/Flipping_image/photos
> File Size                       : 1128 kB
> File Modification Date/Time     : 2016:12:12 10:01:18+01:00
> 
> [...]
> 
> Field Of View                   : 60.3 deg
> Focal Length                    : 3.7 mm (35 mm equivalent: 31.0 mm)
> Hyperfocal Distance             : 1.47 m
> 
> 
> the only difference I see is the weight of this photo (1,1MB, the other
> being less than 0.7MB)
> 
> then i need some light in order to find what is broken here.

Due to security fixes in PHP 5.6.24 and 7.0.9 some of the Exif
funtionality has been broken.  So, which PHP version do you use?

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#17204

FromUne Bévue <unbewusst.sein@fai.invalid>
Date2016-12-13 18:23 +0100
Message-ID<o2paqs$3dc$1@shakotay.alphanet.ch>
In reply to#17202
Le 13/12/2016 à 17:28, Christoph M. Becker a écrit :
> Due to security fixes in PHP 5.6.24 and 7.0.9 some of the Exif
> funtionality has been broken.  So, which PHP version do you use?
PHP Version 5.6.25

Butnotice I'm not using an Exif functionnality bultin PHP but rather the 
commandline exiftool.

[toc] | [prev] | [next] | [standalone]


#17207

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2016-12-14 00:19 +0100
Message-ID<o2pvl5$7gj$1@solani.org>
In reply to#17204
On 13.12.2016 at 18:23, Une Bévue wrote:

> Le 13/12/2016 à 17:28, Christoph M. Becker a écrit :
>
>> Due to security fixes in PHP 5.6.24 and 7.0.9 some of the Exif
>> funtionality has been broken.  So, which PHP version do you use?
>
> PHP Version 5.6.25
> 
> Butnotice I'm not using an Exif functionnality bultin PHP but rather the
> commandline exiftool.

I was so fixated on the ext/exif issues that I didn't fully read your
post.  Sorry for the noise!

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#17203

From"R.Wieser" <address@not.available>
Date2016-12-13 18:03 +0100
Message-ID<5850292e$0$21545$e4fe514c@news.xs4all.nl>
In reply to#17200
Une,

> the only difference I see is the weight of this photo (1,1MB,
> the other being less than 0.7MB)

Another difference is that the other three are compliant to the old 8.3 DOS
format, while the latter has a much longer filename.

Try renaming it to something short and see what happens.

Regards,
Rudy Wieser


-- Origional message:
Une Bévue <unbewusst.sein@fai.invalid> schreef in berichtnieuws
o2p6o9$pgl$1@shakotay.alphanet.ch...
> Hey all,
>
> I have a folder with photos :
>
> $ ls -al '/Users/yt/Sites/tests/Flipping_image/photos/'
> total 4848
> drwxr-xr-x  10 yt  staff   340B 13 déc 09:46 .
> drwxr-xr-x  10 yt  staff   340B 13 déc 07:48 ..
> -rw-r--r--   1 yt  staff   1,1M 12 déc 10:01 20161202_085945.jpg
> -rw-r--r--   1 yt  staff    66K 13 déc 08:10 Cirques.jpg
> -rw-r--r--   1 yt  staff   662K 13 déc 08:27 Cirques.png
> -rw-r--r--   1 yt  staff   541K  6 déc 13:43 IMG_3130.JPG
>
> those photos have the same user and group and also the same rights
> '-rw-r--r--'.
>
> i need to read exif infos from those files using the php script :
>
>    $EXIFTOOL = '/usr/local/bin/exiftool';
>    $cmd = "$EXIFTOOL " . $data['PATH'];
>    exec($cmd, $Infos, $ExitStatus);
>    foreach($Infos as $line) {
>      $fields = explode(' : ', $line, 2 );
>      if(count($fields) == 2) {
>        $data[rtrim($fields[0])] = $fields[1];
>      }
>    }
>    $data['ExitStatus'] = $ExitStatus;
>
> for 3 of those photos :
> Cirques.jpg
> Cirques.png
> IMG_3130.JPG
>
> i get back the good exif infos, like :
> {
>    "ExifTool Version Number":  "10.20",
>    "File Name":  "IMG_3130.JPG",
>    "Directory":  "\/Users\/yt\/Sites\/tests\/Flipping_image\/photos",
>    "File Size":  "541 kB",
>    [...]
>    "Hyperfocal Distance":  "1.82 m",
>    "Light Value":  "4.0",
>    "ExitStatus":  0
> }
>
> ($data is send thru json_encode)
>
> however for the photo '20161202_085945.jpg' the php script returns
> nothing even no error althought I'm able, on terminal to retrieve those
> datas :
> $ /usr/local/bin/exiftool
> /Users/yt/Sites/tests/Flipping_image/photos/20161202_085945.jpg
> ExifTool Version Number         : 10.20
> File Name                       : 20161202_085945.jpg
> Directory                       :
> /Users/yt/Sites/tests/Flipping_image/photos
> File Size                       : 1128 kB
> File Modification Date/Time     : 2016:12:12 10:01:18+01:00
>
> [...]
>
> Field Of View                   : 60.3 deg
> Focal Length                    : 3.7 mm (35 mm equivalent: 31.0 mm)
> Hyperfocal Distance             : 1.47 m
>
>
> the only difference I see is the weight of this photo (1,1MB, the other
> being less than 0.7MB)
>
> then i need some light in order to find what is broken here.
>
> best,
>
> YT


[toc] | [prev] | [next] | [standalone]


#17205

FromUne Bévue <unbewusst.sein@fai.invalid>
Date2016-12-13 18:28 +0100
Message-ID<o2pb4k$3dc$2@shakotay.alphanet.ch>
In reply to#17203
Le 13/12/2016 à 18:03, R.Wieser a écrit :
> Another difference is that the other three are compliant to the old 8.3 DOS
> format, while the latter has a much longer filename.

OK, but I'm using macOS Sierra...

> Try renaming it to something short and see what happens.

Anyway, I renamed it 'glasgow.jpg', no result with php, and again using 
terminal I got it :

$ exiftool /Users/yt/Sites/tests/Flipping_image/photos/glasgow.jpg
ExifTool Version Number         : 10.20
File Name                       : glasgow.jpg
Directory                       : 
/Users/yt/Sites/tests/Flipping_image/photos
File Size                       : 1128 kB
File Modification Date/Time     : 2016:12:12 10:01:18+01:00

[...]

Circle Of Confusion             : 0.004 mm
Field Of View                   : 60.3 deg
Focal Length                    : 3.7 mm (35 mm equivalent: 31.0 mm)
Hyperfocal Distance             : 1.47 m

[toc] | [prev] | [next] | [standalone]


#17206

From"J.O. Aho" <user@example.net>
Date2016-12-13 23:42 +0100
Message-ID<ebbbpsF2t59U1@mid.individual.net>
In reply to#17200
On 12/13/2016 05:14 PM, Une Bévue wrote:

> i need to read exif infos from those files using the php script :
> 
>   $EXIFTOOL = '/usr/local/bin/exiftool';
>   $cmd = "$EXIFTOOL " . $data['PATH'];
>   exec($cmd, $Infos, $ExitStatus);
>   foreach($Infos as $line) {
>     $fields = explode(' : ', $line, 2 );
>     if(count($fields) == 2) {
>       $data[rtrim($fields[0])] = $fields[1];
>     }
>   }
>   $data['ExitStatus'] = $ExitStatus;
> 
> for 3 of those photos :
> Cirques.jpg
> Cirques.png
> IMG_3130.JPG
> 
> i get back the good exif infos, like :
> {
>   "ExifTool Version Number":  "10.20",
>   "File Name":  "IMG_3130.JPG",
>   "Directory":  "\/Users\/yt\/Sites\/tests\/Flipping_image\/photos",
>   "File Size":  "541 kB",
>   [...]
>   "Hyperfocal Distance":  "1.82 m",
>   "Light Value":  "4.0",
>   "ExitStatus":  0
> }
> 
> however for the photo '20161202_085945.jpg' the php script returns
> nothing even no error

What's the exit status code?

Have you verified that the path is correct? Is it a full path or a
relative path (in this case it may not be relative to the script
executed first)?


If your script takes all the files in the directory, but always missing
one file, then your outer loop has issues, as you haven't provided how
you get your $data in the first place, it's just a guessing game for us
who ain't mind readers.


-- 

 //Aho

[toc] | [prev] | [next] | [standalone]


#17208

FromUne Bévue <unbewusst.sein@fai.invalid>
Date2016-12-14 07:02 +0100
Message-ID<o2qna0$kea$1@shakotay.alphanet.ch>
In reply to#17206
Le 13/12/2016 à 23:42, J.O. Aho a écrit :
> What's the exit status code?
>
> Have you verified that the path is correct? Is it a full path or a
> relative path (in this case it may not be relative to the script
> executed first)?

full PATH

>
> If your script takes all the files in the directory, but always missing
> one file, then your outer loop has issues, as you haven't provided how
> you get your $data in the first place, it's just a guessing game for us
> who ain't mind readers.

no the script is activated by :
http://mbp.local/tests/Flipping_image/php/exiftool-json.php?PATH=/Users/yt/Sites/tests/Flipping_image/photos/glasgow.jpg

and the whole script is :

<?php
$EXIFTOOL = "/usr/local/bin/exiftool";
$SITES = "/Users/yt/Sites";
$data = array();
if(isset($_GET['URL'])) {
   $data['URL'] = $_GET['URL'];
   $data['PATH'] = $SITES . $_GET['URL'];
}
if(isset($_GET['PATH'])) {
   $data['URL'] = explode($SITES, $_GET['PATH'], 2 )[1];
   $data['PATH'] = $_GET['PATH'];
}
header('Content-Type: application/javascript');
date_default_timezone_set('Europe/Paris');
setlocale(LC_CTYPE, 'fr_FR');
error_reporting(E_ALL);

function exifTool() {
   global $EXIFTOOL;
   global $data;
   $cmd = "$EXIFTOOL " . $data['PATH'];
   exec($cmd, $Infos, $ExitStatus);
   foreach($Infos as $line) {
     $fields = explode(' : ', $line, 2 );
     if(count($fields) == 2) {
       $data[rtrim($fields[0])] = $fields[1];
     }
   }
   $data['ExitStatus'] = $ExitStatus;
   return $data;
}
echo json_encode(exifTool());
?>

the script is not missing one file. even if I hardcode the path within 
the script has for example :
$data['PATH'] = '/Users/yt/Sites/tests/Flipping_image/photos/glasgow.jpg';

i get absolutely nothing. no errors.

[toc] | [prev] | [next] | [standalone]


#17210

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-12-14 17:37 +0100
Message-ID<3147213.R56niFO833@PointedEars.de>
In reply to#17208
Une Bévue wrote:

> Le 13/12/2016 à 23:42, J.O. Aho a écrit :
>> What's the exit status code?
>>
>> Have you verified that the path is correct? Is it a full path or a
>> relative path (in this case it may not be relative to the script
>> executed first)?
> 
> full PATH
> 
>> If your script takes all the files in the directory, but always missing
>> one file, then your outer loop has issues, as you haven't provided how
>> you get your $data in the first place, it's just a guessing game for us
>> who ain't mind readers.
> 
> no the script is activated by :
> http://mbp.local/tests/Flipping_image/php/exiftool-json.php?PATH=/Users/yt/Sites/tests/Flipping_image/photos/glasgow.jpg

You are an obnoxious, anti-social pseudonymous address munger who does not 
deserve this piece of advice.  But to prevent you from harming others in 
your blissful ignorance, and as a warning to others, I am making an 
exception and reply:

You *really* do NOT want to do that.  The least you want to do here is 
calling escapeshellarg($_GET['PATH']) before you pass it to exec(), so that 
an attacker cannot execute *arbitrary code* on that box (see below for an 
example of that).

But even then allowing *anyone* to access *any* file on that box poses a 
great security risk.  You must realize that as by your code any information 
output by exiftool(1) is contained in the JSON HTTP response, an attacker 
can determine which files are on that box, what is the file size, the file 
modification and access times, the file permissions, and for which processor 
architecture have binaries been compiled.  Because exiftool(1) is much more 
than just a tool to read EXIF (image) metadata.

Fasten your seatbelt and try

http://mbp.local/tests/Flipping_image/php/exiftool-json.php?PATH=/bin/sh

I can debug this manually, and make a good prediction as to what you will 
get:

> and the whole script is :
> 
> <?php
> $EXIFTOOL = "/usr/local/bin/exiftool";
> $SITES = "/Users/yt/Sites";
> $data = array();

processed

> if(isset($_GET['URL'])) {

false

>    $data['URL'] = $_GET['URL'];
>    $data['PATH'] = $SITES . $_GET['URL'];
> }

ignored

> if(isset($_GET['PATH'])) {

true

>    $data['URL'] = explode($SITES, $_GET['PATH'], 2 )[1];

irrelevant

>    $data['PATH'] = $_GET['PATH'];

  $data['PATH'] = '/bin/sh';

> }
> header('Content-Type: application/javascript');

That is the *wrong* MIME media type for a JSON response.  JSON is a data 
format, not executable source code.

<http://json.org/>
<http://fr.wikipedia.org/wiki/JSON>

> date_default_timezone_set('Europe/Paris');
> setlocale(LC_CTYPE, 'fr_FR');
> error_reporting(E_ALL);
> 
> function exifTool() {
>    global $EXIFTOOL;
>    global $data;
>    $cmd = "$EXIFTOOL " . $data['PATH'];

  $cmd = "/usr/local/bin/exiftool /bin/sh";

>    exec($cmd, $Infos, $ExitStatus);

  exec("/usr/local/bin/exiftool /bin/sh", $Infos, $ExitStatus);

Imagine what would have happened here if I had accessed

http://mbp.local/tests/…/php/exiftool-json.php?PATH=%2F%3Brm%20-rf%20%2F

(Just IMAGINE; DO NOT TRY this [at least not without changing “exec” to 
“echo”]!)

>    foreach($Infos as $line) {
>      $fields = explode(' : ', $line, 2 );
>      if(count($fields) == 2) {

AFAICS there will always be two fields with exiftool(1).

>        $data[rtrim($fields[0])] = $fields[1];
>      }
>    }
> 
>    $data['ExitStatus'] = $ExitStatus;

  $data = [
    'URL'                             => 'something irrelevant',
    'PATH'                            => '/bin/sh',
    'ExifTool Version Number        ' => '10.25',
    'File Name                      ' => 'sh',
    'Directory                      ' => '/bin',
    'File Size                      ' => '110 kB',
    'File Modification Date/Time    ' => '2016:07:05 23:59:04+02:00',
    'File Access Date/Time          ' => '2016:12:14 10:44:49+01:00',
    'File Inode Change Date/Time    ' => '2016:07:10 17:50:26+02:00',
    'File Permissions               ' => 'rwxr-xr-x',
    'File Type                      ' => 'ELF shared library',
    'File Type Extension            ' => 'so',
    'MIME Type                      ' => 'application/octet-stream',
    'CPU Architecture               ' => '64 bit',
    'CPU Byte Order                 ' => 'Little endian',
    'Object File Type               ' => 'Shared object file',
    'CPU Type                       ' => 'AMD x86-64',
    'ExitStatus'                      => 0
  ];

or similar.

>    return $data;
> }
> echo json_encode(exifTool());
> ?>

Omit the last line: <http://www.php-fig.org/psr/psr-2/#2-2-files>
 
> the script is not missing one file. even if I hardcode the path within
> the script has for example :
> $data['PATH'] = '/Users/yt/Sites/tests/Flipping_image/photos/glasgow.jpg';
> 
> i get absolutely nothing. no errors.

There may be no error messages, but certainly there is an _$ExitStatus_ (as 
your fellow anti-social address munger, “J.O. Aho”, said).

Also, $data is only filled if there are exactly two fields.  Maybe that is 
the problem – in addition to the many other problems with this code.

-- 
PointedEars
Zend Certified PHP Engineer <http://www.zend.com/en/yellow-pages/ZEND024953>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#17212

FromUne Bévue <unbewusst.sein@fai.invalid>
Date2016-12-14 18:13 +0100
Message-ID<o2ruki$ke1$1@shakotay.alphanet.ch>
In reply to#17210
Le 14/12/2016 à 17:37, Thomas 'PointedEars' Lahn a écrit :
>> }
>> header('Content-Type: application/javascript');
> That is the *wrong* MIME media type for a JSON response.  JSON is a data
> format, not executable source code.

U're right ! according to :
<http://www.ietf.org/rfc/rfc4627.txt>

i changed that to :
header('Content-Type: application/json');

for the security issue, i don't take care because this page in only a 
***local*** test.

[toc] | [prev] | [next] | [standalone]


#17209 — [BADLY SOLVED]: prob with exec, exiftool and one photo

FromUne Bévue <unbewusst.sein@fai.invalid>
Date2016-12-14 08:11 +0100
Subject[BADLY SOLVED]: prob with exec, exiftool and one photo
Message-ID<o2qrbc$th3$1@shakotay.alphanet.ch>
In reply to#17200
from command line, using :
exiftool  -s 
'/Users/yt/Sites/tests/Flipping_image/photos/20161202_085945.jpg'

i saw a faulty encoding line :
Comment                         : File written by Adobe Photoshop� 5.0
looks here_______________________________________________________^_____

then i write to the file :

$ exiftool  -s -Comment='' 
'/Users/yt/Sites/tests/Flipping_image/photos/20161202_085945.jpg'
     1 image files updated

afterwards I'm able to read other infos, using php.

I don't know this comment tag speaking about photoshop, because this 
photo comes from a Samsung SM-N7505 phone.

The photo, by itself didn't be open by Photoshop rather send by email...

[toc] | [prev] | [next] | [standalone]


#17211 — Re: [BADLY SOLVED]: prob with exec, exiftool and one photo

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-12-14 17:43 +0100
SubjectRe: [BADLY SOLVED]: prob with exec, exiftool and one photo
Message-ID<3256428.MHq7AAxBmi@PointedEars.de>
In reply to#17209
Une Bévue wrote:

> from command line, using :
> exiftool  -s
> '/Users/yt/Sites/tests/Flipping_image/photos/20161202_085945.jpg'
> 
> i saw a faulty encoding line :
> Comment                         : File written by Adobe Photoshop� 5.0
> looks here_______________________________________________________^_____

That is not faulty encoding; the “Ⓡ” (“R”) for “registered trademark” or the 
“™” (“(tm)”) for “trademark” *belongs there*, and *you* have not used the 
correct locale encoding to decode it.

But as you can see from my other follow-up, you have much bigger problems to 
solve than "faulty encoding".

-- 
PointedEars
Zend Certified PHP Engineer <http://www.zend.com/en/yellow-pages/ZEND024953>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#17213 — Re: [BADLY SOLVED]: prob with exec, exiftool and one photo

FromUne Bévue <unbewusst.sein@fai.invalid>
Date2016-12-14 18:24 +0100
SubjectRe: [BADLY SOLVED]: prob with exec, exiftool and one photo
Message-ID<o2rv7n$ln5$1@shakotay.alphanet.ch>
In reply to#17211
Le 14/12/2016 à 17:43, Thomas 'PointedEars' Lahn a écrit :
> That is not faulty encoding; the “Ⓡ” (“R”) for “registered trademark” or the
> “™” (“(tm)”) for “trademark” *belongs there*, and *you* have not used the
> correct locale encoding to decode it.

my locale encoding is "fr_FR.UTF-8".

I don't want to change it for Photoshop ;-)

I think if "Ⓡ” is the correct glyph, I would have seen it on terminal :
.-[yt@mbp.local:~]-[16-12-14 18:20:35]
'->$ set toto ®
.-[yt@mbp.local:~]-[16-12-14 18:20:35]
'->$ echo $toto
®

then the metadatas for this photo isn't UTF-8 encoded ?
only US-ASCII is correct.

[toc] | [prev] | [next] | [standalone]


#17216 — Re: [BADLY SOLVED]: prob with exec, exiftool and one photo

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-12-14 19:57 +0100
SubjectRe: [BADLY SOLVED]: prob with exec, exiftool and one photo
Message-ID<2082037.NG923GbCHz@PointedEars.de>
In reply to#17213
Une Bévue wrote:

> Le 14/12/2016 à 17:43, Thomas 'PointedEars' Lahn a écrit :
>> That is not faulty encoding; the “Ⓡ” (“R”) for “registered trademark” or
>> the “™” (“(tm)”) for “trademark” *belongs there*, and *you* have not used
>> the correct locale encoding to decode it.
> 
> my locale encoding is "fr_FR.UTF-8".
> 
> I don't want to change it for Photoshop ;-)

You could change it temporarily when executing exiftool(1).

But you really need to fix the gaping security leaks in your code first.

When you have done that, you need to post with an e-mail address and a real 
name before I consider reading to your postings again.  I can only give you 
that much leeway.

> then the metadatas for this photo isn't UTF-8 encoded ?

Very likely.

> only US-ASCII is correct.

How did you get that idea?

-- 
PointedEars
Zend Certified PHP Engineer <http://www.zend.com/en/yellow-pages/ZEND024953>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#17214 — Re: [BADLY SOLVED]: prob with exec, exiftool and one photo

From"R.Wieser" <address@not.available>
Date2016-12-14 19:01 +0100
SubjectRe: [BADLY SOLVED]: prob with exec, exiftool and one photo
Message-ID<58518846$0$21457$e4fe514c@news.xs4all.nl>
In reply to#17211
Thomas,

> and *you* have not used the correct locale encoding to decode it.

Thats bull, and you know it.   It does not need to be "decoded", it needs to
be *extracted", and nothing more.

The only place where that locale decoding is needed is when it needs to be
*displayed*.   Nowhere else.


Une, there *might* be a possibility that PHP for some reason does not want
to store unicode and therefore returns an empty result.

J.O. did a good suggestion: Check which error is returned.  It's provided
especially for you as the programmer so you have an easier task to home-in
on the cause of the problem.

Also, do not let "pointed ears" here scare you.  He's just like that.  He
tries to sound as if he's either some internet cop or otherwise allowed to
make demands, but he's harmless.

> You are an obnoxious, anti-social pseudonymous address munger
> who does not deserve this piece of advice

And as always you are the hypocrite, demanding stuff like other people must
use "true names" -- and even telling them where exactly in the message they
should put it --  while violating it yourself with impunity.  :-)

Regards,
Rudy Wieser



-- Origional message:
Thomas 'PointedEars' Lahn <PointedEars@web.de> schreef in berichtnieuws
3256428.MHq7AAxBmi@PointedEars.de...
> Une Bévue wrote:
>
> > from command line, using :
> > exiftool  -s
> > '/Users/yt/Sites/tests/Flipping_image/photos/20161202_085945.jpg'
> >
> > i saw a faulty encoding line :
> > Comment                         : File written by Adobe Photoshop? 5.0
> > looks here_______________________________________________________^_____
>
> That is not faulty encoding; the "?" ("R") for "registered trademark" or
the
> "T" ("(tm)") for "trademark" *belongs there*, and *you* have not used the
> correct locale encoding to decode it.
>
> But as you can see from my other follow-up, you have much bigger problems
to
> solve than "faulty encoding".
>
> --
> PointedEars
> Zend Certified PHP Engineer
<http://www.zend.com/en/yellow-pages/ZEND024953>
> <https://github.com/PointedEars> | <http://PointedEars.de/wsvn>
> Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per
E-Mail.

[toc] | [prev] | [next] | [standalone]


#17215 — Re: [BADLY SOLVED]: prob with exec, exiftool and one photo

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-12-14 19:39 +0100
SubjectRe: [BADLY SOLVED]: prob with exec, exiftool and one photo
Message-ID<2144039.jE0xQCEvom@PointedEars.de>
In reply to#17214
R.Wieser wrote:

> Thomas,

Don’t you "Thomas" me, _R._Wieser.  You have yet to earn that privilege.

>> and *you* have not used the correct locale encoding to decode it.
> 
> Thats bull, and you know it.   It does not need to be "decoded", it needs
> to be *extracted", and nothing more.

Utter nonsense.
 
> The only place where that locale decoding is needed is when it needs to be
> *displayed*.   Nowhere else.

Not displayed, but output.  And, if you cared to read, they are using the 
output of an external program.
 
> Une, there *might* be a possibility that PHP for some reason does not want
> to store unicode and therefore returns an empty result.

And Santa Claus comes down the chimney.
 
>> You are an obnoxious, anti-social pseudonymous address munger
>> who does not deserve this piece of advice
> 
> And as always you are the hypocrite, demanding stuff like other people
> must use "true names" -- and even telling them where exactly in the
> message they should put it --  while violating it yourself with impunity.  

I would have killfiled you for this if that were not done automatically 
already because of your anti-social address munging on top of your anti-
social denying to post with your real name.  FOAD.

-- 
PointedEars
Zend Certified PHP Engineer <http://www.zend.com/en/yellow-pages/ZEND024953>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#17222 — Re: [BADLY SOLVED]: prob with exec, exiftool and one photo

From"R.Wieser" <address@not.available>
Date2016-12-17 09:11 +0100
SubjectRe: [BADLY SOLVED]: prob with exec, exiftool and one photo
Message-ID<5854f280$0$21435$e4fe514c@news.xs4all.nl>
In reply to#17215
Thomas,

> Utter nonsense.

Poppycock.

> Not displayed, but output.

Not output, just stored.

> And, if you cared to read, they are using the output of an external
program.

You say that is if its important.    Which it isn't.

> And Santa Claus comes down the chimney.

Actually that sounds less dumb than you "you just match your local language
setting with whatever is used in the image" suggestion.   Really doable when
those pictures could come from sources (people as well as devices) the OP
has absolutily no control over.

And there has even been talk that Santa can "fold" himself so he can even
pass thru the smallest of airducts, to visit the good kids in homes without
a fireplace. :-)

> I would have killfiled you for this if that were not done automatically
> already because of your anti-social address munging on top of your anti-
> social denying to post with your real name.  FOAD.

Lol.   You would just doing me a favour, as I can than just warn other
people without you posting another of your obnoxious "I'm the president of
the internet, heed my demands" posts. :-)

Besides, you're lying.  You neither killfile, nor are doing it
automatically.  How I know that ?   Because we met before where you said
pretty-much the same and you *still* respond to my posts. :-)

> because of your anti-social address munging on top of your
> anti-social denying to post with your real name

Lol again.   The hypocrite demanding something he refuses to give himself,
and just plain stupid enough to not being able to understand, in this
time-and-age of internet spam, why email adresses are being kept private.

Regards,
Rudy Wieser


-- Origional message:
Thomas 'PointedEars' Lahn <PointedEars@web.de> schreef in berichtnieuws
2144039.jE0xQCEvom@PointedEars.de...
> R.Wieser wrote:
>
> > Thomas,
>
> Don't you "Thomas" me, _R._Wieser.  You have yet to earn that privilege.
>
> >> and *you* have not used the correct locale encoding to decode it.
> >
> > Thats bull, and you know it.   It does not need to be "decoded", it
needs
> > to be *extracted", and nothing more.
>
> Utter nonsense.
>
> > The only place where that locale decoding is needed is when it needs to
be
> > *displayed*.   Nowhere else.
>
> Not displayed, but output.  And, if you cared to read, they are using the
> output of an external program.
>
> > Une, there *might* be a possibility that PHP for some reason does not
want
> > to store unicode and therefore returns an empty result.
>
> And Santa Claus comes down the chimney.
>
> >> You are an obnoxious, anti-social pseudonymous address munger
> >> who does not deserve this piece of advice
> >
> > And as always you are the hypocrite, demanding stuff like other people
> > must use "true names" -- and even telling them where exactly in the
> > message they should put it --  while violating it yourself with
impunity.
>
> I would have killfiled you for this if that were not done automatically
> already because of your anti-social address munging on top of your anti-
> social denying to post with your real name.  FOAD.
>
> --
> PointedEars
> Zend Certified PHP Engineer
<http://www.zend.com/en/yellow-pages/ZEND024953>
> <https://github.com/PointedEars> | <http://PointedEars.de/wsvn>
> Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per
E-Mail.

[toc] | [prev] | [next] | [standalone]


#17226 — Re: [BADLY SOLVED]: prob with exec, exiftool and one photo

FromJerry Stuckle <jstucklex@attglobal.net>
Date2016-12-17 09:33 -0500
SubjectRe: [BADLY SOLVED]: prob with exec, exiftool and one photo
Message-ID<o33i8q$blt$1@jstuckle.eternal-september.org>
In reply to#17222
On 12/17/2016 3:11 AM, R.Wieser wrote:
> Thomas,
> 
>> Utter nonsense.
> 
> Poppycock.
> 
>> Not displayed, but output.
> 
> Not output, just stored.
> 
>> And, if you cared to read, they are using the output of an external
> program.
> 
> You say that is if its important.    Which it isn't.
> 
>> And Santa Claus comes down the chimney.
> 
> Actually that sounds less dumb than you "you just match your local language
> setting with whatever is used in the image" suggestion.   Really doable when
> those pictures could come from sources (people as well as devices) the OP
> has absolutily no control over.
> 
> And there has even been talk that Santa can "fold" himself so he can even
> pass thru the smallest of airducts, to visit the good kids in homes without
> a fireplace. :-)
> 
>> I would have killfiled you for this if that were not done automatically
>> already because of your anti-social address munging on top of your anti-
>> social denying to post with your real name.  FOAD.
> 
> Lol.   You would just doing me a favour, as I can than just warn other
> people without you posting another of your obnoxious "I'm the president of
> the internet, heed my demands" posts. :-)
> 
> Besides, you're lying.  You neither killfile, nor are doing it
> automatically.  How I know that ?   Because we met before where you said
> pretty-much the same and you *still* respond to my posts. :-)
> 
>> because of your anti-social address munging on top of your
>> anti-social denying to post with your real name
> 
> Lol again.   The hypocrite demanding something he refuses to give himself,
> and just plain stupid enough to not being able to understand, in this
> time-and-age of internet spam, why email adresses are being kept private.
> 
> Regards,
> Rudy Wieser
> 
> 

That's Pointed Head for you, Rudy.  He never has anything positive to
add to a conversation but demands everyone follow *his* rules.  Its no
wonder he is known as a troll in so many newsgroups.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#17218 — Re: [BADLY SOLVED]: prob with exec, exiftool and one photo

FromUne Bévue <unbewusst.sein@fai.invalid>
Date2016-12-15 06:19 +0100
SubjectRe: [BADLY SOLVED]: prob with exec, exiftool and one photo
Message-ID<o2t94c$lfi$1@shakotay.alphanet.ch>
In reply to#17214
Le 14/12/2016 à 19:01, R.Wieser a écrit :
> Une, there *might* be a possibility that PHP for some reason does not want
> to store unicode and therefore returns an empty result.
>
> J.O. did a good suggestion: Check which error is returned.

That's true, however, with that Trademark glyph in the comment field, I 
don't have even an error, with :
exec($cmd, $Infos, $ExitStatus);

$Infos and $ExitStatus are empty...

In fact, in the meantime, I've found another solution, for the time 
being : don't read comment field.

then my $cmd has to be completed :
   $options = '-s -c \"%.8f\" ' . $data['short_options'];
   $cmd = "$EXIFTOOL $options" . $data['PATH'];

with :

$EXIFTOOL = "/usr/local/bin/exiftool";

and "$data['short_options']" build from :
$SHORT_INFOS = array();
$SHORT_INFOS['XMP'] = ['Lens'];
$SHORT_INFOS['EXIF'] = explode(' ', 'Make Model ExposureTime FNumber ISO 
FlashMode FocalLength');

$data['short_options'] = getOptions($SHORT_INFOS);

function getOptions($tab) {
   $out = ' ';
   foreach ($tab as $key => $fields){
       foreach($fields as $field) {
         $out .= "-$key:$field ";
       }
   }
   return $out;
}

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.php


csiph-web