FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Help with imagecopy





Dougie1
Does image copy copy part of an image onto another?

Also Could someone clarify what data you have to give the function is... I don't really understand the php manual.

Quote:
imagecopy ( resource $dst_im, resource $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h )


Is the Destination image the image that you are pasting on to?

Is the Source image the one that is being pasted?

Could you also explain the rest. Thanks.
bgillingham
Quote:
Does image copy copy part of an image onto another?
Sure, it can be used to do a partial copy, but usually you'd just want to use the same width and height as the original. So, I guess you could chop an image into as many little images of whatever rectangle coordinates within the bounds of the source image area.

This is pretty much all that you'd need to know - to copy an image to another. You need to know a few things before the call -
$src_im image resource that you are copying from
$w, $h width and height of image that you are copying from (the destination image will be copied with the same value - for a resample, check out imagecopyresampled() with very similar parameters and usage)

Code:

  $dst_im = imagecreatetruecolor($w, $h);
  imagealphablending($src_im, false);  // may not need to use this line
  imagesavealpha($src_im, true);  // may not need to use this line
  imagecopy($dst_im, $src_im, 0, 0, 0, 0, $w, $h);
  // NOTE: only destroy when you know you are
  // done using the variable - you may need
  // to hold onto this for another operation */
  //   imagedestroy($src_im); 
  // copy into other variable if this makes sense for your needs
  //   $src_im = $dst_im; 


Code:
imagecopy ( resource $dst_im, resource $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h )

For your variables,
$dst_im the target or destination image resource
$src_im source image resource
$dst_x, $dsx_y destination origin point used for copy
$src_x, $src_y source origin point used for copy
$src_w, $src_h source width and height to define overall rectangle that will be used for copy

Notice that the destination width and height do not need to be specified as one of the values that you actually pass to copyimage(), but it is actually part of the image destination object that you created before calling this.
Related topics
A Little PHP GD Help...
can i help?
help,Bonding
HELP!!
Help me with MySQL Account Maintenance and phpBB 2.0.15 :((
help, change pass my acc in cpanel
help me upgrade php to 5.
Need help adding a domain
help add admin in phpbb forum
How to solve this problem? Thanks
Help!
Help me change port for phptriad
problam Plz help
Help!!
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.