diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/derivative.inc.php | 5 | ||||
-rw-r--r-- | include/functions.inc.php | 10 | ||||
-rw-r--r-- | include/ws_functions.inc.php | 13 |
3 files changed, 14 insertions, 14 deletions
diff --git a/include/derivative.inc.php b/include/derivative.inc.php index c22e27573..282b500ec 100644 --- a/include/derivative.inc.php +++ b/include/derivative.inc.php @@ -42,10 +42,7 @@ final class SrcImage } elseif (!empty($infos['representative_ext'])) { - $pi = pathinfo($infos['path']); - $file_wo_ext = get_filename_wo_extension($pi['basename']); - $this->rel_path = $pi['dirname'].'/pwg_representative/' - .$file_wo_ext.'.'.$infos['representative_ext']; + $this->rel_path = original_to_representative($infos['path'], $infos['representative_ext']); } else { diff --git a/include/functions.inc.php b/include/functions.inc.php index afd3ea702..80b25281b 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -731,6 +731,16 @@ function check_theme_installed($theme_id) return file_exists($conf['themes_dir'].'/'.$theme_id.'/'.'themeconf.inc.php'); } +/** Transforms an original path to its pwg representative */ +function original_to_representative($path, $representative_ext) +{ + $pos = strrpos($path, '/'); + $path = substr_replace($path, 'pwg_representative/', $pos+1, 0); + $pos = strrpos($path, '.'); + return substr_replace($path, $representative_ext, $pos+1); +} + + /* Returns the PATH to the thumbnail to be displayed. If the element does not * have a thumbnail, the default mime image path is returned. The PATH can be * used in the php script, but not sent to the browser. diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php index 5839ce9e9..2c14feac4 100644 --- a/include/ws_functions.inc.php +++ b/include/ws_functions.inc.php @@ -1741,7 +1741,7 @@ SELECT // update metadata from the uploaded file (exif/iptc) require_once(PHPWG_ROOT_PATH.'admin/include/functions_metadata.php'); - update_metadata(array($image_id=>$file_path)); + sync_metadata(array($image_id)); } $info_columns = array( @@ -1925,16 +1925,9 @@ SELECT id, name, permalink // update metadata from the uploaded file (exif/iptc), even if the sync // was already performed by add_uploaded_file(). - $query = ' -SELECT - path - FROM '.IMAGES_TABLE.' - WHERE id = '.$image_id.' -;'; - list($file_path) = pwg_db_fetch_row(pwg_query($query)); require_once(PHPWG_ROOT_PATH.'admin/include/functions_metadata.php'); - update_metadata(array($image_id=>$file_path)); + sync_metadata(array($image_id)); return array( 'image_id' => $image_id, @@ -3328,7 +3321,7 @@ SELECT id, path, tn_ext, has_high, width, height global $conf; $conf['use_exif'] = false; $conf['use_iptc'] = false; - update_metadata(array($image['id'] => $image['path'])); + sync_metadata(array($image['id'])); return $result; } |