Cahnge dpi of image from 200 to 72

Discussion in 'PHP' started by vikaspa, Jan 28, 2010.

  1. #1
    Dear alll

    We have plenty of images to be uploaded of 200 dpi

    is there a php code that will make the image from 200 doi to 72 dpi while uploading
     
    vikaspa, Jan 28, 2010 IP
  2. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #2
    First of all, make sure you actually understand what DPI means. Based on the way you phrased your question, it sounds like you don't.

    Anyway, to change the image resolution, use Imagick::setImageResolution().

    To change the size, use Imagick::resampleImage().

    Until you figure out what you are actually trying to achieve, it's hard to guess which one is correct for your application. Maybe both. Or maybe it's one of the 90% of cases where DPI doesn't actually matter and you can just ignore it.
     
    SmallPotatoes, Jan 28, 2010 IP
  3. krishmk

    krishmk Well-Known Member

    Messages:
    1,376
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    185
    #3
    You can use imagick_setdpi() to change the DPI of your images.
    You will have to upload the photos into your webserver and then write a PHP script which would loop through each of the images and set the DPI to your discretion.
     
    krishmk, Jan 28, 2010 IP
  4. jNorth

    jNorth Peon

    Messages:
    202
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4

    Yes, he is correct. In reality, changing the DPI will not affect anything (such as file size or actual size).
     
    jNorth, Feb 3, 2010 IP