SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    964
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wideimage resize constraint from height?

    I am trying to make an resize script with the use of wideimage. But I want to resize the image if its landscape to 125 px height or if its potrait to 125 wide... How do I do so? Here is what I got now:
    PHP Code:
    $img WideImage::loadFromFile($_FILES['file']['tmp_name']);
            
    $img $img->resize(125);
            
    $img->saveToFile('profileimages/' $file);
            
    $cropped $img->crop('center''center'125125);
            
    $cropped->saveToFile('profileimages/' $file); 
    I want to make my images exactly 125 px square without any empty spaces.

    Any ideas anyone?

    Thanks in advance...

  2. #2
    SitePoint Zealot
    Join Date
    Jan 2011
    Location
    Portland
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what is the name of your form field for the file?
    coming soon sitejuju.com my new development portfolio

  3. #3
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    964
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jgetner View Post
    what is the name of your form field for the file?
    file

  4. #4
    SitePoint Zealot
    Join Date
    Jan 2011
    Location
    Portland
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $img WideImage::loadFromFile($_FILES['file']['tmp_name'])->resize(125 124 'outside')->crop('center''center'125125)->saveToFile('yourfile path'); 
    coming soon sitejuju.com my new development portfolio


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
  •