PHP & Images [Resize, Crop, Save]


Posted on 16th Feb 2014 07:03 pm by admin

Hey! Well I have a little dilema, hoping I could find some guidance.

I have a CMS and on the actual website I am building I have a nice little slideshow script that runs through all the images in a certain directory. The dimensions of the slideshow are 900x250. (Obviously not all images come in this size straight from the camera so I need a little resize crop and save script to do this for the user)

I would like the 'admin' to be able to upload an image (or more than one at the same time, if it's not much more hard work) and then PHP simply takes over from there. At which point the images would be resized to 900px in width (keeping the aspect ratio) and then cropped to take the middle 250px out. then this image is saved in "images/slideshow" as a 900x250 pixel image? The format it is saved in isn't that much of a problem.

Thanks a lot in advance! Any guidance is appreciated!

For example, this image:
http://thewalkingtree.files.wordpress.com/2009/07/children-1.jpg

Would become:
http://img503.imageshack.us/img503/4315/kidsl.png

No comments posted yet

Your Answer:

Login to answer
180 Like 46 Dislike
Previous forums Next forums
Other forums

Members Only
Hi all, for my website i have a members area only which on members can veiw, but at the moment anyon

please, need help coding this voting for your favorite car polling system.
hi, my code needs a lot of work, but i want to be able to let users vote on their favorite car, upda

Undefined index: username HELP NEWBIE
I am trying a simple login/logout for my website. It works well with checking if the username exists

Web Application Recipe
Hi Guys!

I am working with the Web Application recipes. I am currently working on the sen

How to use Substr
I want to check for the word CATEGORY: inside a string which can be CATEGORY: ITEM
and remove the

Mail sending is slow on server
Why mail is taking time to be send on apache-linux server

upgrade from 4.7 to ECC 6.0
Hi all,
we are going to do an upgrade from R/3 4.7 to ECC 6.0. I need to know if i can find som

Help me with some material on Open Text Overview.
Hi Experts,
Please help me out with some material on Open Text. I have been supporting AP Workf

Sequre login with cookies.
I want to build secure login with cookies. I just want your ideas about this, your suggestions. What

Rounding a number queried from a database
I know that to display a rounded number you just do echo "round($number)";. But how would

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash