php-windows Digest 5 Jul 2001 14:36:25 -0000 Issue 637

Topics (messages 8123 through 8124):

GD-Library and very large images.
        8123 by: Arve Bersvendsen

Is this possible?
        8124 by: Michel Laine

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------


I use the following simple script to resize large images (typically 
4000x4000 pixels and up).  After upgrading to PHP 4.06, and the GD-
Library bundled with that release, the result images become either 
yellow or black (seems to be dependant on what kind of image), when the 
source image is wider than 2048 pixels.

<?php
    $size = getImageSize($imgfile);
    if ((!$x)|| (!$y)) {
        $x = $size[0];
        $y = $size[1];
    }
    switch ($size[2]) {
        case 2:
          $in_img = ImageCreateFromJpeg($imgfile);
          $out_format = 1;
          break;
        case 3:
          $in_img = ImageCreateFromPng($imgfile);
          $out_format = 2;
          break;
        default:
          die("File is not jpg or png. Terminating");
    }

    $out_img = ImageCreate($x,$y); 
    $color = ImageColorAllocate($out_img,255,255,255);
    imagecolortransparent($out_img, $color);
    ImageCopyResized($out_img, $in_img, 0, 0, 0, 0, $x, $y, $size[0], 
$size[1]);
  
    switch ($out_format) {
        case 1:
          header ("Content-type: image/jpeg");
          ImageJPEG($out_img);
        case 2:  
          header ("Content-type: image/png");
          ImagePNG($out_img);
        default: 
          die("should never happen");
    }

?>

I am wondering whether there is something wrong with my script, or with 
GD-library.

I am running Apache 1.3.20r2 and PHP4.06 on Windows 2000 Professional 



-- 
Arve         «The pessimist sees difficulty in every opportunity.
               The optimist sees opportunity in every difficulty.» 
                                             - Winston Churchill
http://www.bersvendsen.com/




Using PHP 404pl1 / MySQL 3.23.35 / PWS / W98SE if anybody should need to
know...
The stuff is for an intranet application.

1: To execute php code when a A HREF link is clicked.

I have the need to change a session variable depending on which link (of
a couple) that is clicked. The link is supposed to call $PHP_SELF which
then change its output depending on the value of the session variable.
I know that i can solve it by letting the link call different php
scripts - which update the session variable and then call back to the
first page.
If there is another way ( javascript maybe?), i am interested to know
about it.

2: To have one undo step on a database update.

Do anybody know / seen any example / tutorial on how this kind of
function can be implemented?
Let me know!
I have read most of the stuff at Newbie network, PHPdeveloper,
PHPeverywhere, Zend, Devshed, Webmonkey and PHPbuilder - but i have
never come across anything like this.

--

Michel Laine




Reply via email to