Skip to content

Commit

Permalink
feature 2548 multisize - small fixes
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@12958 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
rvelices committed Jan 26, 2012
1 parent 4f216a5 commit 4a73d93
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
14 changes: 9 additions & 5 deletions i.php
Expand Up @@ -73,20 +73,20 @@ function ilog()
if (!mkgetdir($dir) or ! ($ilogfh=fopen($dir.'i.log', 'a')) )
return;
}
fwrite($ilogfh, date("c") );
$line = date("c");
foreach( func_get_args() as $arg)
{
fwrite($ilogfh, ' ' );
$line .= ' ';
if (is_array($arg))
{
fwrite($ilogfh, implode(' ', $arg) );
$line .= implode(' ', $arg);
}
else
{
fwrite($ilogfh, $arg);
$line .= $arg;
}
}
fwrite($ilogfh, "\n");
fwrite($ilogfh, $line."\n");
}

function ierror($msg, $code)
Expand Down Expand Up @@ -396,6 +396,10 @@ function send_derivative($expires)
ierror( $page['src_url'], 301);
}

if ($d_size[0]*$d_size[1] < 100000)
{// strip metadata for small images
$image->strip();
}
$image->set_compression_quality( $params->quality );
$image->write( $page['derivative_path'] );
$image->destroy();
Expand Down
8 changes: 6 additions & 2 deletions picture.php
Expand Up @@ -156,8 +156,11 @@ function default_picture_content($content, $element_info)

if (isset($_COOKIE['picture_deriv']))
{
pwg_set_session_var('picture_deriv', $_COOKIE['picture_deriv']);
setcookie('picture_deriv', false, 0);
if ( array_key_exists($_COOKIE['picture_deriv'], ImageStdParams::get_defined_type_map()) )
{
pwg_set_session_var('picture_deriv', $_COOKIE['picture_deriv']);
}
setcookie('picture_deriv', false, 0, cookie_path() );
}
$deriv_type = pwg_get_session_var('picture_deriv', IMG_LARGE);
$selected_derivative = $element_info['derivatives'][$deriv_type];
Expand Down Expand Up @@ -194,6 +197,7 @@ function default_picture_content($content, $element_info)

$template->assign( array(
'ALT_IMG' => $element_info['file'],
'COOKIE_PATH' => cookie_path(),
)
);
return $template->parse( 'default_content', true);
Expand Down
2 changes: 1 addition & 1 deletion themes/default/template/picture_content.tpl
Expand Up @@ -15,7 +15,7 @@ function changeImgSrc(url,typeSave,typeMap,typeDisplay)
if (elt) elt.innerHTML = typeDisplay;
theImg.useMap = "#map"+typeMap;
}
document.cookie = 'picture_deriv=' + typeSave;
document.cookie = 'picture_deriv='+typeSave+';path={/literal}{$COOKIE_PATH}{literal}';
}

function toggleDerivativeSwitchBox()
Expand Down
4 changes: 2 additions & 2 deletions themes/default/template/thumbnails.tpl
Expand Up @@ -5,11 +5,11 @@
.thumbnails SPAN,
.thumbnails .wrap2 A,
.thumbnails LABEL{ldelim}
width: {$derivative_params->max_width()}px;
width: {$derivative_params->max_width()+2}px;
}

.thumbnails .wrap2{ldelim}
height: {$derivative_params->max_height()+2}px;
height: {$derivative_params->max_height()+3}px;
}
{if $derivative_params->max_width() > 600}
.thumbLegend {ldelim}font-size: 130%}
Expand Down

0 comments on commit 4a73d93

Please sign in to comment.