Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 387167 | Differences between
and this patch

Collapse All | Expand All

(-)concerto-1.9.3-NoCAS/screen/image.php.orig (-1 / +11 lines)
Lines 30-34 Link Here
30
30
31
error_reporting(0);
31
error_reporting(0);
32
32
33
render('image',$_GET['file'], $_GET['width'], $_GET['height']);
33
if ($_GET['stretch']!="")
34
  $stretch=$_GET['stretch'];
35
else
36
  $stretch=false;
37
38
if ($_GET['squish']!="")
39
  $squish=$_GET['squish'];
40
else
41
  $squish=false;
42
43
render('image',$_GET['file'], $_GET['width'], $_GET['height'], $stretch, $squish);
34
?>
44
?>
(-)concerto-1.9.3-NoCAS/screen/signage.js.orig (-2 / +6 lines)
Lines 70-76 Link Here
70
                                    //create the background image
70
                                    //create the background image
71
                                    $("<img>")
71
                                    $("<img>")
72
                                        .attr({"src": imgSrc,
72
                                        .attr({"src": imgSrc,
73
                                               "alt": ""
73
                                               "alt": "",
74
                                               "id": "bkgndimg"
74
                                        })
75
                                        })
75
                                        .css({"position": "absolute", 
76
                                        .css({"position": "absolute", 
76
                                              "left": "0",
77
                                              "left": "0",
Lines 133-138 Link Here
133
                                            });
134
                                            });
134
                                    } else if(json["mime_type"].match(/image/)){
135
                                    } else if(json["mime_type"].match(/image/)){
135
                                        var imgSrc = "image.php?file=" + escape(json["content"]) + "&width=" + field["width"] + "&height=" + field["height"];
136
                                        var imgSrc = "image.php?file=" + escape(json["content"]) + "&width=" + field["width"] + "&height=" + field["height"];
137
                                        if ((document.getElementById("bkgndimg").width==1280)&&(document.getElementById("bkgndimg").height==1024))
138
                                            imgSrc+="&squish=1";
136
                                        //load the image to cache
139
                                        //load the image to cache
137
                                        var img = new Image();
140
                                        var img = new Image();
138
                                        //set onload event handler
141
                                        //set onload event handler
Lines 143-149 Link Here
143
                                                .css({"position": "absolute", 
146
                                                .css({"position": "absolute", 
144
                        					          "opacity": "0.0",
147
                        					          "opacity": "0.0",
145
	                                                  "left": field["left"] + (field["width"] - img.width) / 2,
148
	                                                  "left": field["left"] + (field["width"] - img.width) / 2,
146
	                                                  "top": field["top"] + (field["height"] - img.height) / 2
149
	                                                  "top": field["top"] + (field["height"] - img.height) / 2,
150
                                                          "border": "0px"
147
                                                })
151
                                                })
148
                                                .appendTo(document.body)
152
                                                .appendTo(document.body)
149
                                                .fadeGlobal(field["prevdiv"], function(){
153
                                                .fadeGlobal(field["prevdiv"], function(){
(-)concerto-1.9.3-NoCAS/content/render/render.php.orig (-2 / +2 lines)
Lines 24-30 Link Here
24
 * @version      $Revision: 712 $
24
 * @version      $Revision: 712 $
25
 */
25
 */
26
26
27
function render($type, $filename, $width = false, $height = false, $stretch = false){
27
function render($type, $filename, $width = false, $height = false, $stretch = false, $squish = false){
28
	$fileinfo = split("\.", $filename);
28
	$fileinfo = split("\.", $filename);
29
	if($type == 'image'){
29
	if($type == 'image'){
30
		$cache_path = IMAGE_DIR . 'cache/' . $fileinfo[0] . '_' . $width . '_' . $height . '.' . $fileinfo[1];
30
		$cache_path = IMAGE_DIR . 'cache/' . $fileinfo[0] . '_' . $width . '_' . $height . '.' . $fileinfo[1];
Lines 66-72 Link Here
66
		} else { 
66
		} else { 
67
			include_once(COMMON_DIR.'image.inc.php');
67
			include_once(COMMON_DIR.'image.inc.php');
68
			ob_start(); //Start a buffer to catch the image data
68
			ob_start(); //Start a buffer to catch the image data
69
			$type = resize($path, $width, $height, $stretch); //If not, lets resize it.
69
			$type = resize($path, $width, $height, $stretch, $squish); //If not, lets resize it.
70
			$dat = ob_get_contents(); //Read the image data generated
70
			$dat = ob_get_contents(); //Read the image data generated
71
			$size = mb_strlen($dat);
71
			$size = mb_strlen($dat);
72
			header('Content-Length: ' . $size);
72
			header('Content-Length: ' . $size);
(-)concerto-1.9.3-NoCAS/common/image.inc.php.orig (-27 / +43 lines)
Lines 23-29 Link Here
23
 * @license      GPLv2, see www.gnu.org/licenses/gpl-2.0.html
23
 * @license      GPLv2, see www.gnu.org/licenses/gpl-2.0.html
24
 * @version      $Revision: 712 $
24
 * @version      $Revision: 712 $
25
 */
25
 */
26
function resize($filename, $new_width = false, $new_height = false, $stretch = false){
26
function resize($filename, $new_width = false, $new_height = false, $stretch = false, $squish = false){
27
    list($width, $height, $type_int) = getimagesize($filename);
27
    list($width, $height, $type_int) = getimagesize($filename);
28
    if(!$stretch) {
28
    if(!$stretch) {
29
        if(!$new_width || !$new_height) {
29
        if(!$new_width || !$new_height) {
Lines 43-78 Link Here
43
        }
43
        }
44
    }
44
    }
45
45
46
    $new_image = imagecreatetruecolor($new_width, $new_height);
46
    if (!$squish) {
47
    $image = @imagecreatefromjpeg($filename) or //Read JPEG
47
      $new_image = imagecreatetruecolor($new_width, $new_height);
48
    $image = @imagecreatefrompng($filename) or //Read PNG
48
      $image = @imagecreatefromjpeg($filename) or //Read JPEG
49
    $image = @imagecreatefromgif($filename) or //Read GIF
49
      $image = @imagecreatefrompng($filename) or //Read PNG
50
    $image = false;
50
      $image = @imagecreatefromgif($filename) or //Read GIF
51
      $image = false;
51
52
52
    $type = image_type_to_mime_type($type_int);
53
      $type = image_type_to_mime_type($type_int);
53
    
54
    
54
    //If the image is a PNG, make sure the alpha layer is respected!
55
      //If the image is a PNG, make sure the alpha layer is respected!
55
    if($image && ($type == 'image/png' || $type == 'image/x-png')){
56
      if($image && ($type == 'image/png' || $type == 'image/x-png')){
56
      $alpha = imagecolortransparent($image);
57
        $alpha = imagecolortransparent($image);
57
      if($alpha >= 0){
58
        if($alpha >= 0){
58
        $color = imagecolorsforindex($image, $alpha);
59
          $color = imagecolorsforindex($image, $alpha);
59
        $alpha = imagecolorallocate($new_image, $color['red'], $color['green'], $color['blue']);
60
          $alpha = imagecolorallocate($new_image, $color['red'], $color['green'], $color['blue']);
60
        imagefill($new_image, 0, 0, $alpha);
61
          imagefill($new_image, 0, 0, $alpha);
61
        imagecolortransparent($new_image, $alpha);
62
          imagecolortransparent($new_image, $alpha);
62
      } else {
63
        } else {
63
        imagealphablending($new_image, false);
64
          imagealphablending($new_image, false);
64
        $color = imagecolorallocatealpha($new_image, 0, 0, 0, 127);
65
          $color = imagecolorallocatealpha($new_image, 0, 0, 0, 127);
65
        imagefill($new_image, 0, 0, $color);
66
          imagefill($new_image, 0, 0, $color);
66
        imagesavealpha($new_image, true);
67
          imagesavealpha($new_image, true);
68
        }
69
      }
70
      if($image) {
71
  	    imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
72
          imagedestroy($image);
73
      } else
74
          $new_image = imagecreatetruecolor(3, 3);
75
    } else { // pillarbox it
76
      $src_image=imagecreatetruecolor($new_width*3/4, $new_height);
77
      $src_image = @imagecreatefromjpeg($filename) or //Read JPEG
78
      $src_image = @imagecreatefrompng($filename) or //Read PNG
79
      $src_image = @imagecreatefromgif($filename) or //Read GIF
80
      $src_image = false;
81
      $type="image/png"; // force PNG output
82
83
      $new_image=imagecreatetruecolor($new_width, $new_height);
84
      imagealphablending($new_image, false);
85
      imagesavealpha($new_image, true);
86
      imagefill($new_image, 0, 0, imagecolorallocatealpha($new_image, 0, 0, 0, 127));
87
      if ($src_image) {
88
        imagecopyresampled($new_image, $src_image, $new_width/8, 0, 0, 0, $new_width*3/4, $new_height, $width, $height);
67
      }
89
      }
68
      
69
    }
90
    }
70
    
91
71
    if($image) {
72
	    imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
73
        imagedestroy($image);
74
    } else
75
        $new_image = imagecreatetruecolor(3, 3);
76
        
92
        
77
    
93
    
78
    if($type == "image/jpeg" || $type == 'image/pjpeg' || $type == 'image/jpg'){
94
    if($type == "image/jpeg" || $type == 'image/pjpeg' || $type == 'image/jpg'){

Return to bug 387167