Skip to content

Commit

Permalink
bug:1791 update webservices upload methods
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@10160 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
mistic100 committed Apr 8, 2011
1 parent 758fe84 commit c9ec229
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 32 deletions.
4 changes: 4 additions & 0 deletions include/ws_functions.inc.php
Expand Up @@ -1246,6 +1246,8 @@ function ws_images_addFile($params, &$service)
if ('high' == $params['type'])
{
$update['high_filesize'] = $infos['filesize'];
$update['high_width'] = $infos['width'];
$update['high_height'] = $infos['height'];
$update['has_high'] = 'true';
}

Expand Down Expand Up @@ -1374,6 +1376,8 @@ function ws_images_add($params, &$service)
{
$insert['has_high'] = 'true';
$insert['high_filesize'] = $high_infos['filesize'];
$insert['high_width'] = $high_infos['width'];
$insert['high_height'] = $high_infos['height'];
}

include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
Expand Down
56 changes: 24 additions & 32 deletions picture.php
Expand Up @@ -903,7 +903,26 @@ function default_picture_content($content, $element_info)
$infos['INFO_POSTED_DATE'] = '<a href="'.$url.'" rel="nofollow">'.$val.'</a>';

// size in pixels
if ($picture['current']['is_picture'] and isset($picture['current']['width']) )
if ($picture['current']['is_picture'] AND $picture['current']['has_high'])
{
if (!empty($picture['current']['high_width']))
{
$infos['INFO_DIMENSIONS'] = $picture['current']['high_width'].'*'.$picture['current']['high_height'];
}
else if ($hi_size = @getimagesize($hi_url))
{
pwg_query('
UPDATE ' . IMAGES_TABLE . '
SET
high_width = \'' . $hi_size[0].'\',
high_height = \''.$hi_size[1] .'\'
WHERE id = ' . $picture['current']['id'] . ';
');

$infos['INFO_DIMENSIONS'] = $hi_size[0].'*'.$hi_size[1];
}
}
else if ($picture['current']['is_picture'] and isset($picture['current']['width']) )
{
if ($picture['current']['scaled_width'] !== $picture['current']['width'] )
{
Expand All @@ -919,43 +938,16 @@ function default_picture_content($content, $element_info)
}
}

// hd size in pixels
if ($picture['current']['is_picture'] AND $picture['current']['has_high'])
{
if (!empty($picture['current']['high_width']))
{
$infos['INFO_DIMENSIONS'] = $picture['current']['high_width'].'*'.$picture['current']['high_height'];
}
else
{
$hi_size = @getimagesize($hi_url);
if ($hi_size !== false)
{
pwg_query('
UPDATE ' . IMAGES_TABLE . '
SET
high_width = \'' . $hi_size[0].'\',
high_height = \''.$hi_size[1] .'\'
WHERE id = ' . $picture['current']['id'] . ';
');

$infos['INFO_DIMENSIONS'] = $hi_size[0].'*'.$hi_size[1];
}
}
}

// filesize
if (!empty($picture['current']['filesize']))
if ($picture['current']['has_high'] and !empty($picture['current']['high_filesize']))
{
$infos['INFO_FILESIZE'] =
sprintf(l10n('%d Kb'), $picture['current']['filesize']);
sprintf(l10n('%d Kb'), $picture['current']['high_filesize']);
}

// hd filesize
if ($picture['current']['has_high'] and !empty($picture['current']['high_filesize']))
else if (!empty($picture['current']['filesize']))
{
$infos['INFO_FILESIZE'] =
sprintf(l10n('%d Kb'), $picture['current']['high_filesize']);
sprintf(l10n('%d Kb'), $picture['current']['filesize']);
}

// number of visits
Expand Down

0 comments on commit c9ec229

Please sign in to comment.