Jump to content


Photo

Image Manipulation Using The Gd Library


  • Please log in to reply
1 reply to this topic

#1 gerkintrigg

gerkintrigg
  • Members
  • PipPipPip
  • Magician
  • 828 posts
  • LocationBristol, UK
  • Age:37

Posted 28 June 2006 - 05:39 PM

I'm trying to work out how to resize my image.

I have the following code, which writes my copyright notice across the image (this is for an image bank) but I'd also like to add a watermarked logo to the image aswell as resize the final image.

I tried everything I can think of but the only working version I have (which doesn't do everything I'd like) is this:

<?php 

// Set dimension of image
$Height = 200;
$Width= 300;

// Now make it
$im = ImageCreateFromGif($root.$img_details['url']);
$White = ImageColorAllocate ($im, 100, 100, 100);
$Blue = ImageColorAllocate ($im, 0, 0, 64);

// Resize it:
//$im = ImageCopyResized($Width,$Height);

// draw on image
ImageFill ($im, 0, 0, $blue);
ImageLine ($im, 0, 0, $Width, $Height, $White);
ImageString($im, 11, 2, 5, 'Copyright Protected', $White);
ImageString($im, 11, 2, 25, 'By Next Day Graphics', $White);
ImageString($im, 11, 2, 45, 'Sample Only', $White);

// output image
ImagePng ($im);

// clean up
ImageDestroy($im);?>

Neil Trigger - http://www.ghostlypublishing.co.uk - Ghostly Publishing - Children's Fantasy Books

#2 gerkintrigg

gerkintrigg
  • Members
  • PipPipPip
  • Magician
  • 828 posts
  • LocationBristol, UK
  • Age:37

Posted 29 June 2006 - 01:38 PM

Wow,
How about just the resize option...? anyone?
Please, help...
Please?
Neil Trigger - http://www.ghostlypublishing.co.uk - Ghostly Publishing - Children's Fantasy Books




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users