Responsive Advertisement

Explain two functions to scale the given image.

Explain two functions to scale the given image. 


imagecopyresized() function : It is an inbuilt function in PHP which is used to copy a rectangular portion of one image to another image and resize it. dst_image is the destination image, src_image is the source image identifier. 
Syntax:
 imagecopyresized(dst_image, src_image, dst_x, dst_y,src_x, src_y, dst_w,dst_h,src_w, src_h)
 dst_image: It specifies the destination image resource.
 src_image: It specifies the source image resource.
 dst_x: It specifies the x-coordinate of destination point. 
dst_y: It specifies the y-coordinate of destination point. 
src_x: It specifies the x-coordinate of source point.
 src_y: It specifies the y-coordinate of source point. 
dst_w: It specifies the destination width.
 dst_h: It specifies the destination height. 
src_w: It specifies the source width.
src_h: It specifies the source height.
 Example: imagecopyresized($d_image,$s_image,0,0,50,50,200,200,$s_width, $s_height);
  imagecopyresampled() function : It is used to copy a rectangular portion of one image to another image, smoothly interpolating pixel values thatresize an image. 
Syntax: imagecopyresampled(dst_image, src_image, dst_x, dst_y,src_x, src_y, dst_w,dst_h,src_w, src_h) 
dst_image: It specifies the destination image resource. 
src_image: It specifies the source image resource.
 dst_x: It specifies the x-coordinate of destination point. 
dst_y: It specifies the y-coordinate of destination point. 
ṇsrc_x: It specifies the x-coordinate of source point. 
src_y: It specifies the y-coordinate of source point.
 dst_w: It specifies the destination width
dst_h: It specifies the destination height. 
src_w: It specifies the source width.
 src_h: It specifies the source height.
 Example: imagecopyresampled($d_image,$s_image,0,0,50,50,200,200,$s_widt h,$s_height); 

Post a Comment

0 Comments