SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Somewhere in the Middle East
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Resize & crop image script

    Hi, I really need a script that resizes images to 530 pixels in width and their proportionate value in height. Then I need the PHP script to automatically crop the height of the image to 170 pixels before uploading the image onto the server.

    Previously I've used a PHP script that checks an image's proportions and only uploads it if it is 530x170 pixels, but my client is having difficulty resizing his images to these specifications so I thought I should find a script that does it automatically.

    Many, many thanks,

    Leao

  2. #2
    SitePoint Evangelist spinmaster's Avatar
    Join Date
    Mar 2005
    Posts
    456
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have a look at PHPThumb I used that class already in a couple of projects and totally like it!

  3. #3
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    yup, phpThumb is a very useful script. have a look on www.phpClasses.org as well as they have a huge library of classes which you can use. If you are still stuck let me know and I will post my own resize class.

    Spike
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  4. #4
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Somewhere in the Middle East
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It seems bewildering. Are there any good tutorials for phpThumb?

  5. #5
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    At My Desk!!
    Posts
    1,642
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    php thumb is simple to use and all the info u need is in the documentation that you can print off
    "Am I the only one doing ASP.NET in Delphi(Pascal)?"

  6. #6
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    it is simple if you just want to use the mail phpThumb script. If you want all the filters or multiple calls you will need to use the class file provided.

    For basic funcionality you only need to use the phpThumb.php and the variables file.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  7. #7
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Somewhere in the Middle East
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I used http://www.phpclasses.org/browse/package/2728.html in the end and it works well. I'm new to PHP and can't understand where to begin with phpThumb, I really need an idiot proof tutorial.

    Thanks for your help,

    Leao

  8. #8
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,405
    Mentioned
    81 Post(s)
    Tagged
    3 Thread(s)
    If you have Imagemagick you could build this line into an upload code and it will do what you want:
    PHP Code:
    exec("/usr/local/bin/convert original_image -resize 530x -crop 530x170+0+0 +repage new_image"); 
    http://www.rubblewebs.co.uk/imagemagick/tests/leao.php


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •