Author Topic: [Mod] EXIF 0.3  (Read 348334 times)

0 Members and 1 Guest are viewing this topic.

Offline fatman

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://photo.nixrex.com
[Mod] EXIF 0.3
« Reply #15 on: January 17, 2003, 01:09:58 AM »
I have make a update version 0.3 which use php exif function.
You may have a trial.  I have tried to upload one of your image, seem that it is OK on the ISO, aperture...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] EXIF 0.3
« Reply #16 on: January 17, 2003, 02:27:46 AM »
I probably do something wrong, but it doesnt display anything now....it's like in output no information to display...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline fatman

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://photo.nixrex.com
[Mod] EXIF 0.3
« Reply #17 on: January 17, 2003, 04:20:35 AM »
I have try your site image, also got your error even by the PHP built-in function of 0.3 ....

Quote from: V@no
I probably do something wrong, but it doesnt display anything now....it's like in output no information to display...

Offline jengwen

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.jenrichardsphotography.com
Couldn't get the new version to work
« Reply #18 on: January 17, 2003, 06:37:05 AM »
I tried installing the new version, but couldn't get it to work.  I got a parse error on line 2 of functions.php, a bunch of the usual header errors, and then a category_dropdown function not found error.  I checked for spaces at the end of the php code in case that was causing the header errors, but that wasn't the problem.  I couldn't find my problem, so I put it back to the old version.

From version 0.2 to 0.3, the only things that need to change are replacing the exif.php file and changing the exif section of functions.php.  The rest of the code changes look the same as the prior version.  Is this correct?

Offline fatman

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://photo.nixrex.com
[Mod] EXIF 0.3
« Reply #19 on: January 17, 2003, 03:26:00 PM »
yes. only the exif.php and functions.php changed.

error... maybe the "}" in functions, it is quite easy to del all "}" if change from 0.2 to 0.3.

I list the whole function in functions.php

Code: [Select]

function get_media_code($media_file_name, $image_id = 0, $cat_id = 0, $image_name = "", $mode = "", $show_link = 0, $detailed_view = 0) {
  global $site_template, $site_sess, $lang, $mode;

  if (!get_file_path($media_file_name, "media", $cat_id, 0, 0)) {
    $media = "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
    $site_template->register_vars("iptc_info", "");
  }
  else {
    $media_src = get_file_path($media_file_name, "media", $cat_id, 0, 1);
    $file_extension = get_file_extension($media_file_name);
    $media_icon = "<img src=\"".ICON_PATH."/".$file_extension.".gif\" border=\"0\" alt=\"".$image_name."\" />";
    if ($show_link) {
      $media_icon = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\">".$media_icon."</a>";
    }
    $width_height = "";
    $width = "";
    $height = "";
    $iptc_info = "";
    $src = (!file_exists($media_src) && file_exists(preg_replace("/\/{2,}/", "/", get_document_root()."/".$media_src))) ? preg_replace("/\/{2,}/", "/", get_document_root()."/".$media_src) : $media_src;
    if ($image_info = @getimagesize($src, $info)) {
      $width_height = " ".$image_info[3];
      $width = $image_info[0];
      $height = $image_info[1];
      if ($detailed_view && isset($info['APP13'])) {
        $iptc_array = get_iptc_info($info['APP13']);
        $bgcounter = 0;
        foreach ($iptc_array as $key => $val) {
          $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
          $site_template->register_vars(array(
            "iptc_value" => $val,
            "iptc_name" => $lang['iptc_'.$key],
            "row_bg_number" => $row_bg_number
          ));
          $iptc_info .= $site_template->parse_template("iptc_bit");
        }
      }
      $exif_info = "";
      if ($detailed_view) {
        $exif = exif_read_data ($media_src,'IFD0');
        $bgcounter = 0;
        if ($exif) {
          $exif = exif_read_data ($media_src,0,true);              
          foreach($exif as $key=>$section) {
            if (($key == "IFD0") || ($key == "EXIF")) {
              foreach($section as $name=>$val) {
                 if (!(exif_filter($name)) && exif_filter_control()) continue;
                $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
                $site_template->register_vars(array(
                  "exif_value" => exif_parse_value($name, $val),
                  "exif_name" => $name . ":",
                  "row_bg_number" => $row_bg_number
                ));
                $exif_info .= $site_template->parse_template("exif_bit");
              }
            }
          }
        }
      }
    }
   
    $site_template->register_vars(array(
      "media_src" => $media_src,
      "media_icon" => $media_icon,
      "image_name" => $image_name,
      "width_height" => $width_height,
      "width" => $width,
      "height" => $height,
      "iptc_info" => $iptc_info,
      "exif_info" => $exif_info
    ));  
    $media = $site_template->parse_template("media/".$file_extension);
  }
  return $media;
}

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] EXIF 0.3
« Reply #20 on: January 17, 2003, 04:30:10 PM »
Quote from: V@no
I probably do something wrong, but it doesnt display anything now....it's like in output no information to display...

sry, I figure what was wrong - my images.... :?
after I edit them with that exifer program something really messed up in the pictures, some even got white dots...
hopefuly that program has backup/restore features now everything works fine.
the only thing I'd suggest add to this mod is checking that the picture is jpg, jpeg as in previous version, atherwise in phperror.log get errors.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline jengwen

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.jenrichardsphotography.com
Still getting error
« Reply #21 on: January 17, 2003, 04:51:10 PM »
Quote
Parse error: parse error in /home/jenricha/public_html/4images/includes/functions.php on line 2

Warning: Cannot add header information - headers already sent by (output started at /home/jenricha/public_html/4images/includes/functions.php:2) in /home/jenricha/public_html/4images/includes/sessions.php on line 85

Warning: Cannot add header information - headers already sent by (output started at /home/jenricha/public_html/4images/includes/functions.php:2) in /home/jenricha/public_html/4images/includes/sessions.php on line 85

Warning: Cannot add header information - headers already sent by (output started at /home/jenricha/public_html/4images/includes/functions.php:2) in /home/jenricha/public_html/4images/includes/sessions.php on line 85

Warning: Cannot add header information - headers already sent by (output started at /home/jenricha/public_html/4images/includes/functions.php:2) in /home/jenricha/public_html/4images/includes/sessions.php on line 85

Fatal error: Call to undefined function: get_category_dropdown() in /home/jenricha/public_html/4images/includes/page_header.php on line 132


I cut and pasted the get_media_code section above and replaced it in my currently working functions.php.  I replaced my exif.php with the new one.  I still get the errors above.  Not sure what the problem is.  Thanks for all your help so far.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] EXIF 0.3
« Reply #22 on: January 17, 2003, 05:01:35 PM »
"headers already sent" usualy gets when something is after " ?> " at the end of php file. check again your new exif.php file.
and make sure that u put exif.php in /includes/ folder
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline fatman

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://photo.nixrex.com
[Mod] EXIF 0.3
« Reply #23 on: January 17, 2003, 07:02:26 PM »
Done. just modified
Code: [Select]

      if ($detailed_view) {

to
Code: [Select]

      if ((($file_extension == "jpg") || ($file_extension == "jpeg")) &&($detailed_view)) {


I am thinking to parse the MakerNote, the PHP exif function can't do this.
It is quite a lot info about shooting in this.

Quote from: V@no
Quote from: V@no
only thing I'd suggest add to this mod is checking that the picture is jpg, jpeg as in previous version, atherwise in phperror.log get errors.

Offline jengwen

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.jenrichardsphotography.com
[Mod] EXIF 0.3
« Reply #24 on: January 17, 2003, 11:31:55 PM »
Thanks V@no.  I have already checked for the spaces at the end of the file thinking that might be the problem as well.  I took my working functions.php file and just replaced the get_media_code section fatman put above and that is it.  I also replaced my exif.php file with the new one.  I didn't change anything else and the version 0.2 works OK for me.  The parse error seems to be on the very first IF statement of functions.php, which hasn't changed, so I can't quite figure it out.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] EXIF 0.3
« Reply #25 on: January 18, 2003, 12:10:20 AM »
make sure u didnt miss this step of installation:
Quote from: fatman

2. Open "includes/functions.php" and add after:

Code: [Select]
if (!defined('ROOT_PATH')) {
  die("Security violation");
}


this code:
Code: [Select]
include('exif.php');
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline fatman

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://photo.nixrex.com
[Mod] EXIF 0.3
« Reply #26 on: January 18, 2003, 01:10:23 AM »
....

you can try my functions.php & exif.php, it is 1.7 only with the exif mod.

http://photo.nixrex.com/exif.zip

Offline jengwen

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.jenrichardsphotography.com
[Mod] EXIF 0.3
« Reply #27 on: January 18, 2003, 04:22:15 AM »
Quote
Fatal error: Call to undefined function: exif_read_data() in /home/jenricha/public_html/4images/includes/functions.php on line 388

Fatman, thank you for all your help so far.  Your files fix my other error (I think I saved it as rich text instead of regular which screwed me up), but now when I go to the detail page I get the error above.  I looked in both function.php and exif.php and can't find any function called exif_read_data.  In your original instructions, you mention that you must have PHP 4.2 (I have 4.23) and enable exif.
Quote
Now, for version 0.3, it use the php built in exif function, so you must have the php 4.2 or above and enable the exif option

I wasn't sure what the enable exif part meant.  I am thinking that might be my problem now.  Any thoughts?  Again, thank you so much for this mod and all your help.

Offline fatman

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://photo.nixrex.com
[Mod] EXIF 0.3
« Reply #28 on: January 19, 2003, 09:02:21 AM »
the "--enable-exif " have to do when compile the PHP,  or download a binary or RPM at http://www.aucs.org/rpmcenter/ have enable it.  
you can find your PHP enable or not by phpinfo().

Offline jengwen

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.jenrichardsphotography.com
[Mod] EXIF 0.3
« Reply #29 on: January 20, 2003, 06:09:12 AM »
Thanks.  I did actually research it and come to the same conclusion last night.  I put in a request to my web host and it actually seems like they may recompile for me with the exif enabled.  I am keeping my fingers crossed.