>- see footer for list info -<
Cheers Stephen. I ended up using CSS to hide the bottom half of the pic
instead, but I'll take note of your code.

:O)

aDe

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Stephen Pope
Sent: 01 April 2005 11:28
To: Coldfusion Development
Subject: RE: [CF-Dev] OT PHP Resizing/Cropping Image Problem


>- see footer for list info -<
Try using imagecopyresampled instead of imagecopy

.. (Quick copy from a function I had)..

function crop($x, $y, $width, $height)
  {
    if(!$this->error)
    {
      $tmpimage = imagecreatetruecolor($width, $height);
      imagecopyresampled($tmpimage, $this->img, 0, 0, $x, $y,
                           $width, $height, $width, $height);
      imagedestroy($this->img);
      $this->img = $tmpimage;
      $this->y = $height;
      $this->x = $width;
    }
  }

 HTH

Stephen

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adrian Lynch
Sent: 01 April 2005 02:07
To: CF-Dev
Subject: [CF-Dev] OT PHP Resizing/Cropping Image Problem

>- see footer for list info -<
Hi all, sorry for the OT.

I'm having a problem with some PHP code to crop an image. For some
images I end up with a polarised effect.

Here's the original image:

http://www.halestorm.co.uk/clients/ffwd/images/news/shellyer.jpg

And here's this cropped version:

http://www.halestorm.co.uk/clients/ffwd/scripts/HeadlineImage.php?file=.
./im
ages/news/shellyer.jpg

Not the best example but the only one I have at the moment. You can see
her hair is darken. Anyone come across this before? I'm hunting for an
answer but no luck so far.

The code I'm using is:

<?php
        header ("Content-type: image/jpeg");
        $image = ImageCreateFromJPEG($_GET["file"]);
        $crop = ImageCreate(200, 100);
        ImageCopy($crop, $image, 0, 0, 0, 0, 200, 100);
        ImageJPEG($crop, "", 100);
        ImageDestroy($crop);
        ImageDestroy($image);
?>

Not all images appear this way. Does anyone have any ideas about why
this is happening and if there's an easy way to fix it?

Once again sorry for the OT post.

Thanks.

Adrian Lynch
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.5 - Release Date: 29/03/2005

_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help

>-<
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.0 - Release Date: 31/03/2005

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.0 - Release Date: 31/03/2005

_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to