Merged
authorDan Fuhry <dan@enanocms.org>
Sat, 15 Sep 2012 13:16:59 -0400
changeset 1364 68c17d935750
parent 1363 f1ed3e9298ae (current diff)
parent 1361 26e80700ff1d (diff)
child 1373 851b91febb85
Merged
includes/template.php
--- a/includes/functions.php	Sat Sep 15 13:18:01 2012 -0400
+++ b/includes/functions.php	Sat Sep 15 13:16:59 2012 -0400
@@ -4268,6 +4268,7 @@
 		{
 			die('SECURITY: ImageMagick path is screwy');
 		}
+		$magick_path = escapeshellcmd($magick_path);
 		$cmdline = "$magick_path $in_file_sh -resize \"{$width}x{$height}>\" $out_file_sh";
 		system($cmdline, $return);
 		if ( !file_exists($out_file) )
@@ -4291,7 +4292,7 @@
 		else if ( $ratio < 1 )
 		{
 			// orig. height is greater than width
-			$new_width = round( $height / $ratio );
+			$new_width = round( $height * $ratio );
 			$new_height = $height;
 		}
 		else if ( $ratio == 1 )
@@ -4313,6 +4314,13 @@
 		if ( !$oldimage )
 			throw new Exception('GD: Request to load input image file failed.');
 		
+		if ( $file_ext == 'png' || $file_ext == 'gif' )
+		{
+			imagecolortransparent($newimage, imagecolorallocatealpha($newimage, 0, 0, 0, 127));
+			imagealphablending($newimage, false);
+			imagesavealpha($newimage, true);
+		}
+		
 		// Perform scaling
 		imagecopyresampled($newimage, $oldimage, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig);
 		
--- a/includes/template.php	Sat Sep 15 13:18:01 2012 -0400
+++ b/includes/template.php	Sat Sep 15 13:16:59 2012 -0400
@@ -1472,7 +1472,7 @@
 			
 			$f = microtime_float();
 			$f = $f - $_starttime;
-			$f = round($f, 2);
+			$f = sprintf("%.02f", $f);
 			
 			$t_loc = $lang->get('page_msg_stats_gentime_short', array('time' => $f));
 			$t_loc_long = $lang->get('page_msg_stats_gentime_long', array('time' => $f));
--- a/plugins/SpecialUpdownload.php	Sat Sep 15 13:18:01 2012 -0400
+++ b/plugins/SpecialUpdownload.php	Sat Sep 15 13:16:59 2012 -0400
@@ -250,7 +250,7 @@
 			$extension = ".{$_GET['fmt']}";
 		
 		$cache_filename = ENANO_ROOT . "/cache/{$filename}-{$row['time_id']}-{$width}x{$height}$extension";
-		if ( file_exists($cache_filename) )
+		if ( file_exists($cache_filename) && !isset($_GET['cache_override']) )
 		{
 			$fname = $cache_filename;
 		}
@@ -281,7 +281,7 @@
 			}
 			if ( $allow_scale )
 			{
-				$result = scale_image($orig_fname, $fname, $width, $height);
+				$result = scale_image($orig_fname, $fname, $width, $height, isset($_GET['cache_override']));
 				if ( !$result )
 					$fname = $orig_fname;
 			}