#1
  1. from the lab...
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Nov 2004
    Location
    the land of wind and ghosts
    Posts
    1,844
    Rep Power
    560

    Change colour of an image w/ PHP GD


    Hey folks,

    I'm currently building a fairly basic t-shirt design site, which lets people pick a t-shirt colour, a template, font, and imprint colour, which thus far is working fine.

    It uses a combination of javascript and PHP GD to output the image as they construct it. You can see it here.

    What happens is that it overlays a PNG of whatever design template they choose over top of the shirt. Is there a way that I can create just a black template PNG file, and change the colour of it with PHP GD? If so, what is the method for it?

    Thanks!
  2. #2
  3. Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2008
    Location
    North Carolina
    Posts
    2,674
    Rep Power
    2674
    You could try imagefilter() with the IMAGE_FILTER_COLORIZE constant.

    Comments on this post

    • ran_dizolph agrees
  4. #3
  5. from the lab...
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Nov 2004
    Location
    the land of wind and ghosts
    Posts
    1,844
    Rep Power
    560
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    1
    Rep Power
    0
    Originally Posted by ran_dizolph
    That's the one! Many thanks!
    Hi I'm trying to replicate the same type of thing but not having any luck. Color seems to come out faded. Any chance I can see how it was done? Thanks...

IMN logo majestic logo threadwatch logo seochat tools logo