#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    31
    Rep Power
    12

    Distort image, PHP and GD


    I want to distort an image so that you can kind of see what it is but not really.

    Any way of doing this with php and gd?

    Thanks!
    Derek
  2. #2
  3. doesn't like link-rollover ads
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Sep 2003
    Posts
    1,820
    Rep Power
    151
    let's say you start with some arbitrary jpeg image. you could:
    1) make a gd image resource from it, using imagecreatefromjpeg()
    2) make a blank image resource using imagecreatetruecolor()
    3) use imagecopyresized() to copy chunks of the original

    this would make a copy of the image. now you need to apply some kind of transformation to it, by way of altering the parameters you pass to imagecopyresized(). let's say you wanted to stretch the image, you would make the blank canvas have 2x width of the original. then you would copy from (0,0,w,h) to (0,0,2*w, 2*h).

IMN logo majestic logo threadwatch logo seochat tools logo