Jump to content

Recommended Posts

Hello,

 

I am looking to use this function to resize parts of an image to a fixed thumbnail size. I have used this functions many times, but I am trying to become more advanced as time pass by.

 

I have been looking on the web, however, I cannot find out what these four arguments control. I was hoping somebody knows.

 

I was hoping someone could give me an answer:

 

$src_x

x-coordinate of source point.

 

$src_y

y-coordinate of source point.

 

$dst_w

Destination width.

 

$dst_h

Destination height.

 

Link to comment
https://forums.phpfreaks.com/topic/181049-solved-about-imagecopyresampled/
Share on other sites

$src_x & $src_y are the X & Y position of the source image

X = from the left

Y = from the top

 

now just say you have 2 images, and I wish to put image S on top of image D, these allow me to say where the top left of image S start..

ie

image D has a height of 500 and width of 500

image S has a height of 100 and width of 400

and i want Image S to be in the middle of image D, I would set the $src_x to 50 and  $src_y to 200

((500-400)/2) = 50

((500-100)/2) = 200

 

Now just say Image D was 500x500, but image $dst_w and $dst_h, just resize to to whatever size

 

Hope that makes sense!

 

 

$src_x & $src_y are the X & Y position of the source image

X = from the left

Y = from the top

 

now just say you have 2 images, and I wish to put image S on top of image D, these allow me to say where the top left of image S start..

ie

image D has a height of 500 and width of 500

image S has a height of 100 and width of 400

and i want Image S to be in the middle of image D, I would set the $src_x to 50 and  $src_y to 200

((500-400)/2) = 50

((500-100)/2) = 200

 

Now just say Image D was 500x500, but image $dst_w and $dst_h, just resize to to whatever size

 

Hope that makes sense!

 

Doesn't make sense yet, but after breakfast I will look at it again, and I am certain you have provided enough constructive information for me to find out.

 

Topic solved.

 

Thank you,

Kind regards,

Marius

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.