Results 1 to 3 of 3

Thread: OT: Need a PHP Guru who's good with images

  1. #1
    Constant Bitrate chewiee's Avatar
    Join Date
    Apr 2004
    Location
    Kent, UK
    Posts
    128

    OT: Need a PHP Guru who's good with images

    I hope one of you guys here can help me, I'd be most grateful.

    I've got a bit of code that I've written/stripped from somewhere and I need it to do the following:

    Upload jpg to server
    check orientaiton (landscape or portrait)
    if portrait resize to 240 x 320
    if landscape resize to 320 x 240
    upate table

    ATM it uploads ok, resizes anything to 320 x whatever ratio, consequently portrait images are deeper than landscape ones.
    it then updates the table.

    So the only problem I have is this portrait/landscape resize depending on code.

    Anyone help me out? I really need someone to point me out the error of my ways! So please either PM me or mail me at chewiee 2004 | my4x4,co,uk


    Thanks

    Chewiee

    VW Mk2 Golf GTI 16V:
    Kenwood KDC-W6527 HU
    Silver Travla C134, Slot Loading DVD/CDRW,
    256MB, VIA Epia MII 12000, Carnetix 60W, Xenarc VGA/Composite TS and a GPS Mouse

  2. #2
    FLAC Gutter's Avatar
    Join Date
    Dec 1999
    Location
    Casina, Italy
    Posts
    901
    So you don't know how to determine orientation or your code isn't working? If it's the former, have you tried using the ImageSX and ImageSY functions?

    Code:
    $img_path = "images/picture.jpg";
    $extension = strtolower(substr($img_path, -3));
    
    if ($extension = "gif") {
      $src_img = ImageCreateFromGIF("$img_path")
    } else {
      $src_img = ImageCreateFromJPEG("$img_path")
    }
    
    If (ImageSX($src_img) > ImageSY($src_img)) {
      //Image is wider than it is tall
    } else {
      //Image is taller than it is wide (or the sides are of equal length)
    }
    If it's something in the code that's not working, you're going to have to post the relevant parts before anyone can help you.

  3. #3
    Top Ramen lgbr's Avatar
    Join Date
    Feb 2004
    Location
    Spokane, WA, US
    Posts
    973
    Man, I am out of practice with PHP. I'd help you, but I forgot all the image stuff.

    I can remember a half life script I wrote to get the locations of all players on a server and then map them all out on a jpeg, live.
    Audio Rockford Fosgate: 900 Watt 4-channel amp, 501bd Mono amp
    Computer AMD 2400+ XP, 1 GB DDR RAM, Orbit Micro 250W DC-DC PSU

    Head units are for cheaters!
    sure some girls fake orgasms.....but it's guys like me who fake the whole relationship

Similar Threads

  1. Good Quality Button Images
    By emayers04 in forum MediaCar
    Replies: 0
    Last Post: 06-01-2004, 06:24 PM
  2. Coyote, launch images
    By more mods in forum MediaCar
    Replies: 5
    Last Post: 03-21-2004, 01:48 AM

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
  •