Announcement

  •  » Requests
  •  » Dimensions info is wrong, help!

#1 2007-02-01 16:07:27

membrana
Member
2006-12-19
3

Dimensions info is wrong, help!

hi to all,
i'm new to pwg and php. i installed phpmyadmin to manage the pwg database, the latest mysql and php5. all is setted up and working fine. my gallery consist in about 150.000 files, and more comming soon!
my problem is that the info of the file is shown wrong, or not shown at all.
when i navigate trough my gallery, and i get to the page where i can click the image and download the high resolution one, the info is all wrong.
the DIMENSIONS shown, are those of the preview image, and not of the high file.
the SIZE appear as N/A.

so... how can i fix that?
i haven't made any changes to the source code at all.
thanks.


marto.

Offline

 

#2 2007-02-01 23:29:06

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: Dimensions info is wrong, help!

All info are coming from preview picture. You're right.
We will have a look for a specific change.


the SIZE appear as N/A.
To update it

Create your ./include/config_local.inc.php like:

<?php
// +-----------------------------------------------------------------------+
// |                               metadata                                |
// +-----------------------------------------------------------------------+

// show_iptc: Show IPTC metadata on picture.php if asked by user
$conf['show_iptc'] = false;

// show_iptc_mapping : is used for showing IPTC metadata on picture.php
// page. For each key of the array, you need to have the same key in the
// $lang array. For example, if my first key is 'iptc_keywords' (associated
// to '2#025') then you need to have $lang['iptc_keywords'] set in
// language/$user['language']/common.lang.php. If you don't have the lang
// var set, the key will be simply displayed
//
// To know how to associated iptc_field with their meaning, use
// tools/metadata.php
$conf['show_iptc_mapping'] = array(
  'iptc_keywords'        => '2#025',
  'iptc_caption_writer'  => '2#122',
  'iptc_byline_title'    => '2#085',
  'iptc_caption'         => '2#120'
  );

// use_iptc: Use IPTC data during database synchronization with files
// metadata
$conf['use_iptc'] = true;

// use_iptc_mapping : in which IPTC fields will PhpWebGallery find image
// information ? This setting is used during metadata synchronisation. It
// associates a phpwebgallery_images column name to a IPTC key
$conf['use_iptc_mapping'] = array(
  'keywords'        => '2#025',
  'date_creation'   => '2#055',
  'author'          => '2#122',
  'name'            => '2#005',
  'comment'         => '2#120'
  );

// show_exif: Show EXIF metadata on picture.php (table or line presentation
// avalaible)
$conf['show_exif'] = true;

// show_exif_fields : in EXIF fields, you can choose to display fields in
// sub-arrays, for example ['COMPUTED']['ApertureFNumber']. for this, add
// 'COMPUTED;ApertureFNumber' in $conf['show_exif_fields']
//
// The key displayed in picture.php will be $lang['exif_field_Make'] for
// example and if it exists. For compound fields, only take into account the
// last part : for key 'COMPUTED;ApertureFNumber', you need
// $lang['exif_field_ApertureFNumber']
//
// for PHP version newer than 4.1.2 :
// $conf['show_exif_fields'] = array('CameraMake','CameraModel','DateTime');
//
$conf['show_exif_fields'] = array(
  'Make',
  'Model',
  'DateTimeOriginal',
  'COMPUTED;ApertureFNumber'
  );

// use_exif: Use EXIF data during database synchronization with files
// metadata
$conf['use_exif'] = true;

// use_exif_mapping: same behaviour as use_iptc_mapping
$conf['use_exif_mapping'] = array(
  'date_creation' => 'DateTimeOriginal'
  );
?>

Read comments in the module above.

My parameters for example are:

<?php
$conf['show_iptc'] = true;
$conf['use_iptc'] = true;
$conf['show_exif'] = true;
$conf['use_exif'] = true;
// for PHP version newer than 4.1.2 :
// $conf['show_exif_fields'] = array('CameraMake','CameraModel','DateTime');
$conf['show_exif_fields'] = array(
  'Make',
  'Model',
  'DateTimeOriginal',
  'ExposureTime',
  'FNumber',
  'FocalLength',
  'ExposureBiasValue',
  'MeteringMode',
  'Flash',
  'COMPUTED;ApertureFNumber'
  );   
// use_exif_mapping: same behaviour as use_iptc_mapping
$conf['use_exif_mapping'] = array(
  'date_creation' => 'DateTimeOriginal'
  );
$conf['show_iptc_mapping'] = array(
  'iptc_caption_writer'  => '2#122',
  'iptc_byline_title'    => '2#085',
  'iptc_caption'         => '2#120'
  );
$conf['use_iptc_mapping'] = array(
  'author'          => '2#122',
  'date_creation'   => '2#055',
  'name'            => '2#005',
  'keywords'        => '2#025',
  'comment'         => '2#120'
  );
?>

config_local.inc.php is your file. So just ONLY add parameters you decided to change.
All available parameters do NOT have to be updated directly in config_default.inc.php.

We will be back soon for HR picture.
If we forget you in few days, please Up your topic.
8-)


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#3 2007-02-02 13:50:38

membrana
Member
2006-12-19
3

Re: Dimensions info is wrong, help!

thanks! but i don't understand php... so meanwhile, i "fixed" the info for dimensions and filesize in another way. i had a class or two of C++, and i begun to edit Applescript recently, so i just tried to understand the php code in picture.php and fix it from there... here are the changes, let me know what you think!

// calculation of width and height
if (empty($picture['current']['width']))
{
  $taille_image = @getimagesize($picture['current']['src_file_system']);
  $original_width = $taille_image[0];
  $original_height = $taille_image[1];

}
else
{
  $original_width = $picture['current']['width'];
  $original_height = $picture['current']['height'];
}

//-------------------------------------------------------------------------------------------------
//lines added to know the dimensions of the pwg_high
$taille_image_high = @getimagesize($picture['current']['high_file_system']);
$original_width_high = $taille_image_high[0];
$original_height_high = $taille_image_high[1];

//end of new lines
//-------------------------------------------------------------------------------------------------

// size in pixels
if ($picture['current']['is_picture'])
{
  if ($original_width != $picture_size[0]
      or $original_height != $picture_size[1])
  {
  //here it uses the "_high" variables, so the dimensions are the pwg_high ones.
    $infos['INFO_DIMENSIONS'] =
      '<a href=\"pwg_high/'.$picture['current']['src'].'" title="'.
      l10n('Original dimensions').'">'.
      $original_width_high.'*'.$original_height_high.'</a>';
  }
  else
  {
    $infos['INFO_DIMENSIONS'] = $original_width_high.'*'.$original_height_high;
  }
}
else
{
  $infos['INFO_DIMENSIONS'] = l10n('N/A');
}

// filesize

//-------------------------------------------------------------------------------------------------
//this is a guess that appears to work... it simply takes the info directly from the high files.

$file_size_high = floor(filesize($picture['current']['high_file_system'])/1024);
$infos['INFO_FILESIZE'] =
sprintf(l10n('%d Kb'), $file_size_high);

//end of new lines
//-------------------------------------------------------------------------------------------------

the comments indicate where i made the changes ( this is how my picture.php is, the notes are for myself.... :D )
for now, it works.
thank you very much for your help!!!

Last edited by membrana (2007-02-02 13:57:38)

Offline

 
  •  » Requests
  •  » Dimensions info is wrong, help!

Board footer

Powered by FluxBB

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