Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki-CVS

phase3/includes Image.php,1.8,1.9

 

 

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded


jeluf at users

May 20, 2004, 5:03 AM

Post #1 of 1 (2 views)
Permalink
phase3/includes Image.php,1.8,1.9

Update of /cvsroot/wikipedia/phase3/includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25789

Modified Files:
Image.php
Log Message:
Only generate truecolor PNGs if original image is already truecolor.
Will still generate truecolor for PHP 4.2 or earlier.

Fix for bug #918857

Index: Image.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/Image.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Image.php 9 May 2004 10:55:47 -0000 1.8
--- Image.php 20 May 2004 12:03:22 -0000 1.9
***************
*** 15,19 ****
$historyRes, # result of the query for the image's history
$width, # \
! $height, # --- returned by getimagesize, see http://de3.php.net/manual/en/function.getimagesize.php
$type, # |
$attr; # /
--- 15,20 ----
$historyRes, # result of the query for the image's history
$width, # \
! $height, # |
! $bits, # --- returned by getimagesize, see http://de3.php.net/manual/en/function.getimagesize.php
$type, # |
$attr; # /
***************
*** 36,39 ****
--- 37,51 ----
{
list($this->width, $this->height, $this->type, $this->attr) = getimagesize( $this->imagePath );
+ $gid = getimagesize( $this->imagePath );
+ $this->width = $gid["width"];
+ $this->height = $gid["height"];
+ $this->type = $gid["type"];
+ $this->attr = $gid["attr"];
+ if ( defined( $gid["bits"] ) )
+ {
+ $this->bits = $gid["bits"];
+ } else {
+ $this->bits = 0;
+ }
}
$this->historyLine = 0;
***************
*** 169,172 ****
--- 181,186 ----
# First find out what kind of file this is, and select the correct
# input routine for this.
+
+ $truecolor = false;

switch( $this->type ) {
***************
*** 176,182 ****
--- 190,198 ----
case 2: # JPG
$src_image = imagecreatefromjpeg( $this->imagePath );
+ $truecolor = true;
break;
case 3: # PNG
$src_image = imagecreatefrompng( $this->imagePath );
+ $truecolor = ( $this->bits > 8 );
break;
case 15: # WBMP for WML
***************
*** 191,195 ****
}
$height = floor( $this->height * ( $width/$this->width ) );
! $dst_image = imagecreatetruecolor( $width, $height );
imagecopyresampled( $dst_image, $src_image,
0,0,0,0,
--- 207,215 ----
}
$height = floor( $this->height * ( $width/$this->width ) );
! if ( $truecolor ) {
! $dst_image = imagecreatetruecolor( $width, $height );
! } else {
! $dst_image = imagecreate( $width, $height );
! }
imagecopyresampled( $dst_image, $src_image,
0,0,0,0,

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.