Resizing the image in php for viewing purposes only

后端 未结 15 1703
面向向阳花
面向向阳花 2020-12-14 13:09

Okay, the reason I posted this is because I wasn\'t sure what to search for. I\'ll try to explain it as clearly as I can.

Say, I have an image sized 800x600. The box

15条回答
  •  -上瘾入骨i
    2020-12-14 13:41

    I don't know this fully but once I created a program which would view us thumbnail images for our images. And the code goes like this:

    $src=imagecreatefromjpg("file.jpg");
    $dest=imagecreatetruecolor($destwidth,$destheight);
    $src1=imagecopyresized($dest,$src,0,0,0,0,$destwidth,$destheight,$widthresource,$heightresource);
    echo imagejpeg($dest);
    

    changing the parameters of imagecopyresized which are set to 0,0,0,0 here will crop your image from x1,y1 to x2,y2 Hope this helps

提交回复
热议问题