Announcement

Collapse
No announcement yet.

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

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.
    Don't Click

    Comment


    • #3
      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

      Comment

      Working...
      X