Author: Rahman Haghparast
Updated on: 2017-02-03
Posted on: 2017-02-03
Package: PHP Image Crop and Resize
I developed this code to satisfy my own needs some while ago and decided to make it available to the community.
In my case, I had some files stored on my own server which were big in size and I had to show the images with some fixed width or height on different pages. In that project I developed a code to do this for me.
Since I had the image_id of the images I had and they were all on my own server, I could have some url friendly options for this purpose.
For example if I wanted to change the width of an image to 200 pixels while keeping the aspect ratio, all I had to do was calling a url like this:
where al_23451 was the image id.
Since in general, the images are not on the same server, I modified the code to be able to download images from internet sources and because of that, I cannot have pretty urls here and I had to use parameters from the query string.
With this class, you can easily download images from all internet sources and store them on your server. It will create a folder with the name of the domain on which the image resides and with all the directory structure necessary. If you decide to resize the image, you can simply pass width and height as parameters in the query string.
It also supports watermarks and you can also convert the images to grey. The position of the watermark can also be defined.
You can find a complete documentation with the package as well.
You need to be a registered user or login to post a comment
1,538,539 PHP developers registered to the PHP Classes site.
Be One of Us!
Login Immediately with your account on:
No comments were submitted yet.