Crop Image using imagecopyresampled()

I am working on php crop image. I have use this link here

It works fine but i have to match it with my javascript generated image.

I have one wordpress plung in which is call fancy product designer. I have create one API. So i need to create same image which is created by FPD javascript code.

Js code here

if(jQuery('#fpd-restore-oring-size').is(':checked')) {
    dataURLOpts.left = width_orig - ((width_orig * element.scaleX ) - (element.clippingRect.left - elementPoint.x )) * scaleXTo1 ; = height_orig - ((height_orig * element.scaleY ) - ( - elementPoint.y )) * scaleYTo1 ;
    dataURLOpts.width = element.clippingRect.width * scaleXTo1;
    dataURLOpts.height = element.clippingRect.height * scaleYTo1;

And my php code i have use :

imagecopyresampled($image_resized, $image, 0, 0, $cropWidth, $cropHeight, $final_width, $final_height, $width_old - 2 * $cropWidth, $height_old - 2 * $cropHeight);

I want to know that how can i set left and top as per javascript code.

Please suggest me idea.


Read more here: Crop Image using imagecopyresampled()

Leave a Reply

Your email address will not be published. Required fields are marked *