Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,542
    Thanks
    45
    Thanked 259 Times in 256 Posts

    Downside to color variation through PNG masking?

    The title is complex, but basically I was thinking is... I have an image of which I would like the user to be able to select the border color. The only issue is I don't want to make dozens of images of varying colors if avoidable. What I was thinking instead was to make a the image a PNG where the background of the image matches the background of my site, place the image in a box filled with the color the border should be, and make the border clear on the PNG. Then whatever color the div behind it is would show up as the border color.

    It sounds like a fairly straight forward idea, but I feel like it shouldn't be so straight forward. Can anyone think of downsides to this? Are there situations where the images shouldn't show? Because were that the case, there'd be a giant block of color where the image should be, and if someone goes with something like a neon green, it'd be kinda ugly.

  • #2
    New Coder
    Join Date
    May 2011
    Posts
    79
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Well obviously if your images have larger filesizes it will take them longer to load, resulting in an ugly color box for a few seconds. Also, if anyone wanted to save the image it wouldn't look the same as it would on the site.

    I'm a bit confused as to why you want to do this... But perhaps you should look into php. I'm not familiar with image editing in PHP but this looks interesting...: http://us2.php.net/manual/en/functio...erectangle.php
    Quote Originally Posted by bullant View Post
    Basically - Java is to Javascript as Ham is to Hampster.

  • #3
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,542
    Thanks
    45
    Thanked 259 Times in 256 Posts
    I use PHP commonly, I'm just not very good with image manipulation and have yet to find a good guide/tutorial to it.

    As for why, its simply so I can provide the most in the way of colors/options to the user. The images are used to mark things on my site, and giving them a few color choices would mean I could let them choose how things are marked. I also plan on altering the thickness of the border, so this way, I could make 3 images and have access to what ends up being (lets say 8 colors), 24 separate visual images.

    Of course, I can also make 24 images with diff borders and do that too. Ideally I'd like to figure out how to do it in php, but not sure how. I'll put up a post in the PHP section for it as well.

  • #4
    New Coder
    Join Date
    May 2011
    Posts
    79
    Thanks
    3
    Thanked 4 Times in 4 Posts
    You could also just use css... maybe the easiest way?

    Code:
    <img src="blah.png" style="border:5px solid #00FF00;" />
    But yeah, I think PHP would be the most professional way to go.
    Quote Originally Posted by bullant View Post
    Basically - Java is to Javascript as Ham is to Hampster.

  • #5
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,542
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Nah, the issue isn't the border of the final image (the square), but the border around the content. Essentially I have an icon inside with a stylized border around it, so there's nothing CSS can do for that.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •