What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » imagecopy in PHP

1 votes - 5 average   imagecopy in PHP
Author: Message:
Moo
Full Member
***

Avatar

Posts: 395
Reputation: 19
Joined: Jun 2004
O.P. imagecopy in PHP
I'm a PHP [Image: newbie.gif] and I'd like to know how to use imagecopy (http://is2.php.net/manual/en/function.imagecopy.php). Can you guys help me?

Thanks!
09-04-2004 02:03 PM
Profile E-Mail PM Find Quote Report
Choli
Elite Member
*****

Avatar
Choli

Posts: 4714
Reputation: 42
42 / Male / Flag
Joined: Jan 2003
RE: imagecopy in PHP
quote:
int 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)


Copy a part of src_im onto dst_im starting at the x,y coordinates src_x, src_y with a width of src_w and a height of src_h. The portion defined will be copied onto the x,y coordinates, dst_x and dst_y.

imagecopy copies a block (or region, or rectangle) of an image into another one. It takes 8 parameters:

The two first ones are the destination and source images, respectively.

The last four parameters represent the part of the original image that will be copied. They are the coordinates of the upper left pixel of the rectangle (src_x and src_y) and the width and heigh of the rectangle (src_w and src_h).

The other 2 parameters are dst_x and dst_y, and they represent where the rectangle is going to be placed in in the destination image. They're also the upper left pixel.

If you don't understand that, just ask; but in that case I'd suggest you to begin with easier things in PHP ;)
Messenger Plus! en espaņol:
<< http://www.msgpluslive.es/ >>
<< http://foro.msgpluslive.es/ >>
:plus4:
09-04-2004 02:18 PM
Profile PM Find Quote Report
Moo
Full Member
***

Avatar

Posts: 395
Reputation: 19
Joined: Jun 2004
O.P. RE: imagecopy in PHP
I dont understand (i was just looking for a way to kinda merge 2 images together one of 'em is an image from a script and the other is a normal image)
09-04-2004 02:30 PM
Profile E-Mail PM Find Quote Report
fluffy_lobster
Veteran Member
*****

Avatar
Posts: -2

Posts: 1391
Reputation: 23
36 / Male / Flag
Joined: Nov 2002
RE: imagecopy in PHP
ok, i'll go through the arguments for you in order.  each bullet is an argument (one of the parameters separated by commas):

  • dst_im is the image you're placing the other image on top of.  I assume that's the one created by the script, so it will already have a resource variable.  Probably $im.
  • src_im is the same kind of reference to an image as the first one.  If this is a normal image, you first have to load it into an image resource, using imagecreatefrom*(), for example: $im2 = ImageCreateFromGIF('foo.gif');  -- you then use $im2 as the argument in this function
  • dst_x is the number of pixels from the left of the first image that you want the second image to start.  so if you wanted it on the absolute left, this is 0
  • dst_y is the same thing but from the top.  if you want to copy the image to 10px below the top of the image then set this to 10, etc.
  • src_x is the point from the left of the second image that you want to start copying the image.  if you want the whole image this will be 0.  if you want to crop off the first 10 pixels on the left then this is 10.
  • src_y is the same for the vertical dimensions.  a pixel dimension from the top of the second image
  • src_w is the width of the box that will copy from the second image.  if you want to copy on the whole image then this is the image's width.  if you cropped 10px off the left, this will be 10 fewer than that.  gottit?
  • src_h is the same, but for the height

at the end of it, the image linked to by the resource in the first argument will be updated with the copy of image 2 as you specified

This post was edited on 09-04-2004 at 06:14 PM by fluffy_lobster.
09-04-2004 06:13 PM
Profile E-Mail PM Web Find Quote Report
Moo
Full Member
***

Avatar

Posts: 395
Reputation: 19
Joined: Jun 2004
O.P. RE: imagecopy in PHP
i dont know where to put those arguments (should've said that earlier...)
09-04-2004 06:15 PM
Profile E-Mail PM Find Quote Report
fluffy_lobster
Veteran Member
*****

Avatar
Posts: -2

Posts: 1391
Reputation: 23
36 / Male / Flag
Joined: Nov 2002
RE: imagecopy in PHP
inside the brackets.

imagecopy(arg1,arg2,...)
09-04-2004 06:17 PM
Profile E-Mail PM Web Find Quote Report
Moo
Full Member
***

Avatar

Posts: 395
Reputation: 19
Joined: Jun 2004
O.P. RE: imagecopy in PHP
this isnt really for me... too complicated
09-04-2004 06:19 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On