Technical changes in Piwigo 2.4

This page lists the technical changes that may be useful for plugin and theme developpers to make their extension compatible with Piwigo 2.4.

Local data directory

Replace $conf['local_data_dir'] with $conf['data_location'] See for details

Derivatives (multiple size)


Core functions

  • get_thumbnail_location - removed
  • get_thumbnail_path - removed
  • get_thumbnail_url - deprecated (it will not be there in 2.5) - use Derivative_Image::thumb_url
  • get_high_location, get_high_path, get_high_url - removed
  • get_image_location - removed
  • get_image_path - removed - use ( new SrcImage($infos) )→get_path()
  • get_image_url - removed - use ( new SrcImage($infos) )→get_url()
  • file_path_for_type - removed
  • mkget_thumbnail_dir - removed

Configuration settings

  • $conf['dir_thumbnail'] - removed
  • $conf['prefix_thumbnail'] - removed



  • get_thumbnail_location, get_thumbnail_url
  • get_element_location


get_mimetype_location (replaces get_thumbnail_location)

How To

how to update your .tpl files :

  • to define a size using an default size : {define_derivative name='NAME' type='TYPE'} where NAME is the name of the derivative created (use it like $pwg→derivative($NAME, $src-image), and TYPE can have the values : square, thumb, 2small, xsmall, small, medium, large, xlarge, xxlarge. The sizes corresponding to these types are available in Configuration → Options → Photo sizes
  • to define a new size : {define_derivative name='NAME' width='WIDTH' height='HEIGHT' crop=true/false min_height='MIN_HEIGHT' min_width='MIN_WIDTH'} where NAME is the name of the derivative created (use it like $pwg→derivative($NAME, $src-image), WIDTH and HEIGHT are required and must be numeric values, the attribute crop is optional (default value false), and the attributes min_width and min_height are also optional (only numeric value)
  • to get a url of a picture according to the NAME derivative : {$pwg→derivative_url($NAME, 'src of the original picture')} OR {assign var=my_derivative value=$pwg→derivative($NAME, 'src of the original picture')} with {$my_derivative→get_url()}

List of functions available as {$my_derivative→function()} :

  • get_path() returns the path of the resized picture
  • get_url() ) returns the url of the resized picture
  • same_as_source() returns true if the picture has not been resized
  • get_type() returns 'Orignal' or 'Type' where type can be 'square', 'thumb', '2small', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge' and 'custom'
  • get_size() returns the size of the derivative image as an array : Array { 'width', 'height'}
  • get_size_htm() return the string 'width=”'.$size[0].'” height=”'.$size[1].'”'
  • get_size_hr() returns the string $size[0].' x '.$size[1]
  • get_scaled_size($maxw, $maxh) needs maximum width and maximum height, and returns the new size needed for a scaled reduction
  • get_scaled_size_htm($maxw=9999, $maxh=9999) returns the string 'width=”'.$size[0].'” height=”'.$size[1].'”' where the array size is the size returned by get_scaled_size($maxw, $maxh)
  • is_cached() returns true if the resized picture exists or need to be created via i.php : useful for Ajax loading

List of functions available as template function ie {$pwg→function($NAME, 'src of the original picture')}

  • derivative_url($type, $img) returns the url of the resized picture

Album administration screen (cat_modify)

There is no longer admin.php?page=cat_modify&cat_id=1234, use instead admin.php?page=album-1234

For admin.php?page=cat_perm&cat=1234, use instead admin.php?page=album-1234-permissions

CSS classes renamed on comment_list.tpl

.thumbnailCategories is renamed into .commentsList

.thumbnailCategory is renamed into .commentElement

web API

Methods pwg.images.resizeThumbnail and pwg.images.resizeWebsize are removed (useless due to multiple size algorithms)

pwg.images.addChunk + pwg.images.add

Due to the new “multiple size” feature, Piwigo will no longer use the “thumb” you may send to pwg.images.add. Furthermore, if you provide the “high” version of the photo, Piwigo will no longer use the “file”.

Even if the algorithm has changed in pwg.images.add, it stays fully compatible with remote softwares implementing this method prior to Piwigo 2.4. For example pLoader 1.6 doesn't need to be updated.

To optimize your software using pwg.images.add, you no longer need to send “thumb” and “high” versions of the photos, just send the “file” in the original size (perform a downsize if you want to speed up transfer)


jQuery (1.7.2) is now loaded by default (see themes/default/template/header.tpl) on gallery side.

Back to top
dev/changes_in_2.4.txt · Last modified: 2012/07/13 18:54 by tosca
github twitter facebook google+ newsletter Donate © 2002-2017 · Contact