Announcement

#1 2018-01-14 18:08:46

brianpb007
Member
2018-01-12
15

Best way to show user-supplied text field next to an image?

Hi,

I write a small, flat ASCII report for each image and name it $IMAGE.exf.  I would like to see the report and the image at the same time, not on some other page and not on top of the image.

A tool tip placed adjacent to the image would be a good start. Being able to copy-n-paste from it would be a great, nice-to-have feature.

Is there any way to do something like this:
http://fractasia.com/doc/pic_w_exif_2018.0114.jpg

Note: This is NOT an EXIF DUMP.
It is a report and needs to be shown as a multi-line text field.

    Brian


Image Report:
Aperture                  =>  F/6.3
FocusDistance             =>  1.12
ColorTemperature          =>  4950K +9t
ExposureComp              =>  -1.00
ExposureTime              =>  1/15 sec, ExpMode=Manual
FileName                  =>  BrianPBarnes_211850.jpg, 27 MB
Flash                     =>  On, Return not detected
FocalLength               =>  28.0 mm
FOV                       =>  65.5 deg
ICCProfileName            =>  aRGB
ISO                       =>  2000
Keywords                  =>  Brian P. Barnes, Austin Texas, Fractasia.com, D800E, Brian P. Barnes, Fractasia.com, 6th Street, SXSW 2014
Lens                      =>  AF-S Nikkor 28-300mm f/3.5-5.6G ED VR
LightValue                =>  4.9, Center-weighted average
Model                     =>  Nikon D800E 3000955
ShutterCount              =>  211850
SubSecCreateDate          =>  2014-03-15 21:50:13.70
Title                     =>  Photo by Brian P. Barnes  Fractasia.com
WhiteBalance              =>  Auto

Offline

 

#2 2018-01-14 19:54:08

executive
Member
2017-08-16
686

Re: Best way to show user-supplied text field next to an image?

was one post not enough?

Offline

 

#3 2018-01-14 20:15:25

brianpb007
Member
2018-01-12
15

Re: Best way to show user-supplied text field next to an image?

executive:
<< was one post not enough?

In my original post, I mentioned that I have already looked at all 4 extensions found with TAG:EXIF and named "EXIF View".

Your response:
<< Did you look in the plugin library? Lots of good stuff in there.
<< EXIF View

seems to indicate that you do not read the questions, you just post.

The question was moved from an EXIF_Extension question to a general question regarding how to show a general REPORT along side the image.

I have already searched for and evaluated:
Search: exif, Version: 2.9, Tag: EXIF ->
[2017-10-13] EXIF View-2.9.a -- Converts EXIF values to human readable localized values. Corresponds to EXIF...
[2017-07-09] ImageMagick GPS-1.6 -- Uses ImageMagick (PHP extension) to read exif GPS data.
[2017-03-04] Exiftool GPS-0.7a -- Uses command line exiftool to read exif GPS data
[2017-01-23] Exiftool Keywords-2.8.a -- Uses command line exiftool to read exif keywords.

EXIF_View has been exhaustively covered.

If you know of a method to display an EXISTING, flat ASCII report, verbatim next to the picture, please elaborate. 

Thank you,

    Brian


Uploaded Images

Offline

 

#4 2018-01-14 23:58:53

executive
Member
2017-08-16
686

Re: Best way to show user-supplied text field next to an image?

flop25 wrote:

you can do it with a custom theme or plugin

flop25 wrote:

you can do it with a custom theme or plugin

brianpb007 wrote:

you do not read

You can not be helped.

Offline

 

#5 2018-01-15 01:22:15

brianpb007
Member
2018-01-12
15

Re: Best way to show user-supplied text field next to an image?

E,

If you have a specific plugin, do elaborate.

If all you are re-re-repeating is that A_NEW_MODULE_COULD_BE_WRITTEN, that adds nothing to the discussion.

At least this time you didn't re-re-re-recommend "EXIF View". Thank you.

If you don't know the answer, not posting a non-answer might be best.

TYVM,

    B

Offline

 

#6 2018-01-15 10:45:15

eliz82
Member
Romania
2016-04-27
262

Re: Best way to show user-supplied text field next to an image?

brianpb007 wrote:

If all you are re-re-repeating is that A_NEW_MODULE_COULD_BE_WRITTEN, that adds nothing to the discussion.

There is no other answer. There is no extension that can do what you want. Piwigo is not Wordpress, it do not have 20000 plugins, only 200.

So you have a text report and you want to show it next to the picture?

http://piwigo.org/ext/extension_view.php?eid=543
this demo extension show you methods how can put a text in the description of the photo, how to put a button, etc

Install and activate extension "Local files editor"
Activate "Personal plugin" in the plugin listing
Go to "Personal plugin" tab in local files editor, you can write something like this (inspired from skeleton):

Code:

<?php
/*
Plugin Name: Personal Plugin
Version: 1.0
Description: Personal Plugin
Plugin URI: http://piwigo.org
Author:
Author URI:
*/

add_event_handler('loc_end_picture', 'img_report_loc_end_picture');

function img_report_loc_end_picture() {
  global $template;
  $template->set_prefilter('picture', 'img_report_picture_prefilter');
}

function img_report_picture_prefilter($content) {
  
    $data_string = <<<EOT
Aperture                  =>  F/6.3
FocusDistance             =>  1.12
ColorTemperature          =>  4950K +9t
ExposureComp              =>  -1.00
ExposureTime              =>  1/15 sec, ExpMode=Manual
FileName                  =>  BrianPBarnes_211850.jpg, 27 MB
Flash                     =>  On, Return not detected
FocalLength               =>  28.0 mm
FOV                       =>  65.5 deg
ICCProfileName            =>  aRGB
ISO                       =>  2000
Keywords                  =>  Brian P. Barnes, Austin Texas, Fractasia.com, D800E, Brian P. Barnes, Fractasia.com, 6th Street, SXSW 2014
Lens                      =>  AF-S Nikkor 28-300mm f/3.5-5.6G ED VR
LightValue                =>  4.9, Center-weighted average
Model                     =>  Nikon D800E 3000955
ShutterCount              =>  211850
SubSecCreateDate          =>  2014-03-15 21:50:13.70
Title                     =>  Photo by Brian P. Barnes  Fractasia.com
WhiteBalance              =>  Auto
EOT;
  $data_html = preg_replace("/\r\n|\r|\n/",'<br>', $data_string); //replace Enter character with html <br>
  
  $search = '{if $display_info.author and isset($INFO_AUTHOR)}';
  $replace = '<div id="ImageReport" class="imageInfo">
  <dt>Image Report:</dt>
  <dd style="color:orange;">'.$data_html.'</dd>
</div>' . PHP_EOL;
  return str_replace($search, $replace.$search, $content);
}

If you know PHP you could do something else like reading data from a txt file http://php.net/manual/ro/function.file-get-contents.php

Last edited by eliz82 (2018-01-15 10:54:53)

Offline

 

#7 2018-01-15 16:31:08

brianpb007
Member
2018-01-12
15

Re: Best way to show user-supplied text field next to an image?

Eliz82,

Thank you for the specific extension information and code example directly addressing the question.

I did some reading on the links you provided and see a few references to Perl, but it looks like the extensions are written in PHP (previously the PERL_Hypertext_Processor). Would you happen to know if extensions can be written in Perl?


Being able to see the relevant EXIF data next to the picture gives feedback to help fine tune the shooting process.

Picture captions often show little more than ISO, Aperture and ExposureTime.  ExifTool -all on a D800E .NEF shows 233 items, most of which are incomprehensible.  Often the EXIF button overlays the image with a separate page.

It seems to be such a generally useful feature to have a text blurb displayed immediately adjacent to an image. Not a thin strip above or below like a title or a caption but roughly a 4"x3"  rectangle, buttressing the image.

It could list the people in the picture or tell the story behind the image or show the concise, formatted report of only the salient EXIF data.

I will do more research and hopefully some development on the pointers you mentioned.

Thank you for your help,

    Brian

====================
Gory Details:
get.exif.pl
USAGE: get.exif.pl [-dhaAbFgklmpsv] file [file ...] [dir [dir ...]]
  [-L "List_element_separator"] [DB_ip_addr] [-o output_dir] <enter>
  -d -> DEBUG. Print mountains of useless trivia to STDERR.
  -h -> HELP! Print the usage information and exit.
  -a -> ALL INTELLIGIBLE info skipping boring drivel and dups
  -A -> ALL. Dump ABSOLUTELY everything to the extract file, even junk + dups
  -b -> Best. Ignore data of lesser interest even if in the db. Only the BEST!
  -F -> FLASH. Get specific FLASH (excrutiating) detail EXIF tags
  -g -> Genre tags like IntellectualGenre, SubjectCode, Scene
  -k -> Keywords. Show Keywords as comma delim string or array if -L
  -l -> List. Show list values as arrays w/';' separators, not flat strings
  -L -> List with following array element separator (-l default=semicolon, ';')
  -m -> Master. Look for a NEF MASTER file for exif
  -o -> Output dir. Requires existing dir arg in which to write rpt
  -p -> PWD. Place .exf file in PWD, not necessarily in dir($NEF)
  -s -> STDOUT. Send all output to STDOUT rather than to a .EXF file.
  -v -> Verbose. Spew mountains of useless trivia. Beware!

Offline

 

#8 2018-01-15 19:18:06

flop25
Piwigo Team
2006-07-06
6965

Re: Best way to show user-supplied text field next to an image?

you have to write it in PHP
tools/metadata.php contains what you need to read exif in php ; aka [Github] Piwigo file tools/metadata.php@L93
the skeleton plugin contains what you may need you create a plugin for Piwigo (and all plugins existing are perfect examples too)


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#9 2018-01-16 09:05:16

eliz82
Member
Romania
2016-04-27
262

Re: Best way to show user-supplied text field next to an image?

I think possible to execute external software from PHP like "shell_exec('perl script.pl ...)" . But some hosts admins disable those PHP functions because security concerns https://www.cyberciti.biz/faq/linux-uni … functions/

So:
1) if you don't have access to execute external from PHP you could use previous method:
install cron, or make a cron script from cpanel, and execute that perl script at a specific interval. that perl script should output a exif TXT file for every image in the Piwigo/Upload directory, something like "filename.jpg.txt" . That TXT file output can be showed in a manner similar with my previous example.

2) if your php installation can execute external programs and you can install exiftool on your webserver:
Then I see no point to use perl, because you can show only specific values directly from exiftool, and format them whatever you like with PHP. Example: [Github] Piwigo-exiftool_keywords file main.inc.php
So you can execute an external program from PHP, get the response back to PHP. If you have JSON output (like Exiftool have), it's basically an array (after decode).
Then you can show that Exif values in Piwigo like you normally do (you don't need to write special code for this like I showed you in the previous post).

Some personal plugin example:

Code:

<?php
/*
Plugin Name: Personal Plugin
Version: 1.0
Description: Personal Plugin
Plugin URI: http://piwigo.org
Author:
Author URI:
*/
add_event_handler('format_exif_data', 'ir_format_exif_data');

function ir_format_exif_data($exif, $filepath) {
  if (!function_exists('shell_exec')) { //check if function is not available
    die('shell_exec is disabled. check php.ini');
  }
  $output = shell_exec('exiftool -json "'.$filepath.'"'); //execute external and get the response to variable
  $exiftool_metadata = json_decode($output, true); //convert json to array
  $exif['EXIFTOOL'] = $exiftool_metadata[0]; //add exiftool_exif to php_exif
  //print('<pre>'.print_r($exif,true).'</pre>'); //debug, help for exif configuration
  return $exif;
}
?>

then go to Local Files Editor plugin and you can config exif display like this:

Code:

$conf['show_exif_fields'] = array(
  'Make',
  'Model',
  'DateTimeOriginal',
  'COMPUTED;ApertureFNumber',
  'EXIFTOOL;ApproximateFocusDistance',
  'EXIFTOOL;ColorTemperature',
  'EXIFTOOL;ExposureCompensation',
  'FileName',
  'EXIFTOOL;Flash',
  'EXIFTOOL;LensID',
  'EXIFTOOL;FOV',
  'EXIFTOOL;LightValue',
  );

$lang['exif_field_ApproximateFocusDistance'] = 'Focus Distance'; //demo how to change a field name
$lang['exif_field_ColorTemperature'] = 'Color Temp.'; //demo how to change a field name

$conf['show_iptc'] = true;

this is an example

Offline

 

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2019 · Contact