开发者

How to crop and resize an image file for a profile picture

I'm making a site and I need all the users to have a square profile picture. Could anyone point me开发者_运维技巧 to a site that explains the process of cropping an image/resizing image with php?


Have a look at my simple image manipulation class - https://gist.github.com/880506

It provides basic cropping, resampling and canvas resizing.

You can use it as-is or treat it as a learning source.


first you can get that image width and height with getimagesize() and create an imagestring with file_get_contents() and create a source for your profile image with width and height that you need and create $tmp with imagecreatetrueclor() at the latest you create an image for profile whit imagejpg() the next step you should empty the memory with imagedestroy()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜