Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Sort of embedded images

by t0mas (Priest)
on Jun 28, 2000 at 17:00 UTC ( #20145=CUFP: print w/replies, xml ) Need Help??

Buttons, buttons, buttons - they are anywhere and everywhere. No matter how simple a web-application is - they are there.
I have just one problem with buttons - they are GREY as in boring, concrete and a rainy day. I want them blue, green, yellow, red, you name it, any cool color but GREY.
Since our hex-packing abbot BBQ seems to have made embedded images the latest fashion, Iíve decided to contribute with one of my hacks in this field.
Iím a big fan of letting the users of my web-applications control the look of the HTML I produce for them so I let them control the colors and fonts of most things as I said here. Being a bit extreme, I go a bit further by letting them control the colors of the push buttons (images) in various parts of my apps to match their choice of colors. Here is some code I wrote to generate custom colored buttons.
This is how I do it, but as we all know TIMTOWTDI.

/brother t0mas

Replies are listed 'Best First'.
Website logo's buttons..
by droogz (Initiate) on Jul 02, 2000 at 19:58 UTC
    I have just got done doing a overhall of my site. I used the below Gimp::FU perl script to creat all my new logos for the site. This will also allow me to change the colors without much trouble. I am sure it can be improved.. but it work for me. I also have a similar script to do the small text links.
    #!/usr/bin/perl use Gimp; use Gimp::Fu; register "large_logo", "Create a large logo\nfor use on a website", "My first gimp script... No help here!!!", "Joshua Curtis <joshua\>", "(c)2000 Joshua Curtis", "20000609", N_"<Toolbox>/Xtns/CurtisOnline/Large Logo", "RGB*, GRAYA", [ [PF_FONT, "font", "Font", "-urw-nimbus sans l-bo +ld-r-normal-*-*-640-*-*-p-*-iso8859-1"], [PF_STRING, "text", "Text", "Hello world!"], [PF_COLOUR, "background_color", "Background color", "#41 +69ff"], [PF_COLOUR, "text_color", "Text Color", "#ffd700"], [PF_COLOUR, "shadow_color", "Shadow Color", [0,0,0]], [PF_INT, "x_shadow_offset", "Shadow X Offset","5"], [PF_INT, "y_shadow_offset", "Shadow Y Offset","5"] ], sub { # now do sth. useful with the garbage we got ;) my($font,$text,$bg,$fg,$ds,$xset,$yset)=@_; # set tracing, disable this to get rid of the debugging output #Gimp::set_trace(TRACE_CALL); my $img = new Image (100, 100, RGB); # the __ before the string in the next line indicates text that mus +t be translated my $layer = new Layer ($img, 100, 100, RGB, __"Background", 100, NO +RMAL_MODE); $layer->add_layer(1); # now a few syntax examples Palette->set_foreground($fg); Palette->set_background($bg); fill $layer BG_IMAGE_FILL; my $text_layer = $img->text_fontname(-1, 0, 0, $text, 1, 1, xlfd_si +ze($font), $font); # Get size of the text drawable and resize the image and the # background layer to this size. my($width,$height) = ($text_layer->width,$text_layer->height); ###### # Now we try to account for - numbers... $xset_new = $xset; $yset_new = $yset; if ($xset =~ /-/) { $xset_new =~ s/-//; $width += $xset_new; $xset = 0; } else { $width += $xset; $xset_new = 0; } if ($yset =~ /-/) { $yset_new =~ s/-//; $height += $yset_new; $yset = 0; } else { $height += $yset; $yset_new = 0; } # End - numbers ####### $img->resize($width, $height, $xset_new, $yset_new); $layer->resize($width, $height, $xset_new, $yset_new); ###### # Now we try to give it a bump map... $text_layer->plug_in_bump_map($text_layer,"135.00","55.78",12 +,0,0,0,0,1,0,1); ###### # Now we add a drop shadow.... my $drop_shadow = $text_layer->copy(0); $drop_shadow->set_name("Drop Shadow"); $drop_shadow->add_layer(1); $drop_shadow->resize($width, $height, 0, 0); $drop_shadow->set_preserve_trans(1); Palette->set_background($ds); $drop_shadow->edit_fill(); $drop_shadow->set_preserve_trans(0); $drop_shadow->plug_in_gauss_iir(5.0, 1, 1); $drop_shadow->set_opacity("80.0"); $drop_shadow->set_offsets($xset, $yset); ###### # Flaten the image. $img->flatten; return($img); # return the image, or an empty list, i.e. () }; exit main;
    Joshua M Curtis

    Lancaster Co. Linux Users Group

    ICQ: 59943578
      Cool. I've been thinking about using Gimp for this, but some of my customers run NT and I don't know how WinGimp can handle that. Another way is to use ImageMagick.

      /brother t0mas
RE: Sort of embedded images
by Zoogie (Curate) on Jul 02, 2000 at 08:07 UTC
    As a big fan of letting users customize the way they view sites, this is very cool... up until now I've been using stylesheets to modify the look of the form widgets (this only works in IE it seems... ugh). Doing it through the server adds a lot more customization possibilities and of course is much more platform/browser independent.

    Cool work, t0mas and BBQ!

    - Zoogie

RE: Sort of embedded images
by mrmick (Curate) on Jul 04, 2000 at 17:28 UTC
    This is really cool!
    I can already think of a few forms in which to use this kind of customization for my customers.
RE: Sort of embedded images
by fx (Pilgrim) on Jul 02, 2000 at 20:19 UTC
    "TIMTOWTDI"? I thought it was TMTOWTDI (as in the machine, but then, this is perl, so TMTOWTDI :) == fx, Infinity is Colourless
      I guess you're right. I didn't spell check before posting :)

      /brother t0mas
RE: Sort of embedded images
by PipTigger (Hermit) on Jul 02, 2000 at 12:01 UTC
    There Is Many a Trippy Other Ways To Do It?


    p.s. Jiyaah!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://20145]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2018-05-24 13:44 GMT
Find Nodes?
    Voting Booth?