1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP and Photographs

Discussion in 'PHP' started by DarrenC, Nov 26, 2004.

  1. #1
    Okay, is there anyone who is aware of a script which:
    SEMrush
    When someone uploads a photograph to my server, it changes the size to a specific size automatically, without loosing the quality of the photograph?

    I have a script at the moment which changes the image to a specific size depending on the memory size of the image, and some people are loading up images that are 1500x1000 pixels!

    I want all of the images loaded to be a specific size and good quality. I've heard of GD library but my host doesn't use this.

    Any solutions, ideas or scripts anyone?

    Darren :)
     
    DarrenC, Nov 26, 2004 IP
    SEMrush
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,283
    Likes Received:
    2,599
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    The GD library is your best bet... it's built into PHP if you have the image() functions available.
     
    digitalpoint, Nov 26, 2004 IP
  3. DarrenC

    DarrenC Peon

    Messages:
    3,386
    Likes Received:
    154
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Shawn, sorry I'm an amateur at PHP

    What do you mean by

    'it's built into PHP if you have the image() functions available'

    Darren
     
    DarrenC, Nov 26, 2004 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,283
    Likes Received:
    2,599
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    digitalpoint, Nov 26, 2004 IP
  5. DarrenC

    DarrenC Peon

    Messages:
    3,386
    Likes Received:
    154
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks Shawn, I'll look into this.

    Darren
     
    DarrenC, Nov 26, 2004 IP
  6. sarahk

    sarahk iTamer Staff

    Messages:
    25,251
    Likes Received:
    3,438
    Best Answers:
    100
    Trophy Points:
    665
    #6
    You will ALWAYS get better image reproduction from proper image software such as Photoshop, however PHP will do a very good job too.

    For free "plug and play" software consider one of the many Gallery scripts. I use a free script called.... Gallery on a tennis site - feel free to take a look.

    Sarah
     
    sarahk, Nov 27, 2004 IP
  7. DarrenC

    DarrenC Peon

    Messages:
    3,386
    Likes Received:
    154
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks Sarah.. helpful as usual!

    The photographs are part of the advertisement, so a gallery wouldn't do what I am wanting to do with the photographs that owners upload BUT I could offer this gallery for anyone who has more than 4 photographs and wants to link to the gallery from the advertisement.

    Darren :)
     
    DarrenC, Nov 27, 2004 IP
  8. sarahk

    sarahk iTamer Staff

    Messages:
    25,251
    Likes Received:
    3,438
    Best Answers:
    100
    Trophy Points:
    665
    #8
    You can always take in the ad, then getImageSize() and when you show it on the page just set the dimensions to what you want.

    BTW: have you heard that nortons firewall blocks images with "ad" in the path. Infact, it's got a list as long as your arm of words it doesn't like and you need to be a total geek to find out where to turn it off. Save ads in a folder named pix or something to differentiate from regular images.

    Sarah
     
    sarahk, Nov 27, 2004 IP
  9. DarrenC

    DarrenC Peon

    Messages:
    3,386
    Likes Received:
    154
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Sarah, I don' think any of the image paths have 'ad' in them, but I will have a good look to make sure - might explain why a button owners have to click to update their advertisement cannot be viewed with Norton installed!

    Darren :)
     
    DarrenC, Nov 27, 2004 IP
  10. rvarcher

    rvarcher Peon

    Messages:
    69
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #10
    There are some good, simple examples that you can build on here:

    http://us2.php.net/manual/en/function.imagecopyresampled.php

    - Bert
    http://www.tropicrentals.com
     
    rvarcher, Dec 6, 2004 IP