murfitUK Posted September 25, 2006 Share Posted September 25, 2006 I've got a couple of websites that use background images when hovering over navigation links. I've only got three of them ("acquired" from other people's sites!) so the sites all look the same.Here's what I mean:Got to admit I'm not experienced with images and graphics so am asking how I might be able to produce these sorts of graphics. Note the colour gradient changes from left to right.Is there some sort of website that might allow me to customise my own images to download (for free of course). I've looked at a couple which allow creation of buttons but not graphics like this.I've got MS Paint but can't see anyway to do it and don't really want to install any fancy graphics software for such a small task.Any suggestions?Thanks. Link to comment Share on other sites More sharing options...
holmedwa04 Posted September 25, 2006 Share Posted September 25, 2006 You could make a gradient using MS Word, then copy into paint and save it, but I dont think you can generate them using code really, I would be very impressed if anyone could though, and I would certainly ask them for the coding to do it! Link to comment Share on other sites More sharing options...
Cronthenoob Posted September 25, 2006 Share Posted September 25, 2006 Maybe you can modify this and make it do what you want!http://slayeroffice.com/code/gradient/ Link to comment Share on other sites More sharing options...
holmedwa04 Posted September 25, 2006 Share Posted September 25, 2006 Wow, that is really good! Link to comment Share on other sites More sharing options...
justsomeguy Posted September 25, 2006 Share Posted September 25, 2006 Here's a way to do it in PHP, which I got from the reference for imagefilledrectangle: <?php// The image must be in truecolor mode!! function gradient_region($img, $x, $y, $width, $height,$src_color, $dest_color=0){ $src_alpha = ($src_color) >> 24; $src_red = ($src_color & 0xFF0000) >> 16; $src_green = ($src_color & 0x00FF00) >> 8; $src_blue = ($src_color & 0x0000FF); $dest_alpha = ($dest_color) >> 24; $dest_red = ($dest_color & 0xFF0000) >> 16; $dest_green = ($dest_color & 0x00FF00) >> 8; $dest_blue = ($dest_color & 0x0000FF); $inc_alpha = ($dest_alpha - $src_alpha) / $width; $inc_red = ($dest_red - $src_red)/$width; $inc_green = ($dest_green - $src_green)/$width; $inc_blue = ($dest_blue - $src_blue)/$width; // If you need more performance, the step can be increased for ($i=0;$i<$width;$i++){ $src_alpha += $inc_alpha; $src_blue += $inc_blue; $src_green += $inc_green; $src_red += $inc_red; imagefilledrectangle($img, $x+$i,$y, $x+$i,$y+$height, imagecolorallocatealpha($img, $src_red,$src_green,$src_blue,$src_alpha)); } }?> You could also download The Gimp, it's a free image editor. Link to comment Share on other sites More sharing options...
murfitUK Posted September 26, 2006 Author Share Posted September 26, 2006 Thanks. I'll give it all a try. Link to comment Share on other sites More sharing options...
murfitUK Posted September 30, 2006 Author Share Posted September 30, 2006 I found just the thing - although can't think why it took me so long as I visit Dynamic Drive quite a lot.http://tools.dynamicdrive.com/gradient/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now