php - resizing image with gd or imagick so that it cover its transparent part -


i have image customizing plugin having stage of 1000x700 user can upload his/her pic , design in stage area.

now if user doesn't use full staging area , use part of stage let 800x400. final image of 1000x700 transparent background having user's design in middle of it.

now question is, want stretch user design on full canvas out white background.

how can using php gd or imagick (not manually)?

    $dstimage = imagecreatetruecolor(1000, 700);     $black = imagecolorallocate($dstimage, 0, 0, 0);      // make background transparent     imagecolortransparent($dstimage, $black);      $srcimage = imagecreatefrompng('srcimg.png');     imagecopymerge($dstimage, $srcimage, 0, 0, 0, 800, 400, 1000, 700);     imagepng($dstimage, 'outputnewimg.png'); 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -