Ask a Question related to PHP Development, Design and Development.
-
l'atelier Ho #1
Adding text to a graphic button
Hello to all,
I have to write some scripts for a web side created with
Frontpage.
My customer used some button generated with FP.
He like that I use the same button in my php scripts. I
could save a lot of code and time if I could use only one
graphic button and then add the text on the fly.
My questions, it is possible to do that with PHP. ?
I should put about 20 buttons in a table something like
that:
¦---------¦
¦ Button1 ¦
¦---------¦
¦ Button2 ¦
¦---------¦
¦ Button3 ¦
¦---------¦
etc.
Many thanks in advance for your help.
Otto
l'atelier Ho Guest
-
Button with graphic skin, transition with states,graphic vanishes???
Hi, Two issues. I've got three buttons (components) in a canvas (in an application) that are graphical (round graphics with transparent... -
Dynamically adding Dropdown, Text Box, Add Button and Remove Button
Hi Everyone, I am facing a poblem in creating a row which contains following scenario in ASP.NET |DROP_DOWN_LIST | |TEXT_BOX| ... -
Graphic as form button
How can I use a graphic as a form button for my form submission instead of the default button. Thanks -
Adding a graphic to a PDF file
I have a PDF that was generated using PageMaker however the PM file no longer exists. All I need to do is add a small graphic onto each page of the... -
Using a button graphic to refresh a page
Hello I'm creating a page which will appear as "full-screen" with no browser interface elements whatsoever. I will need to add a Refresh button on... -
Steve #2
Re: Adding text to a graphic button
See [url]http://www.php.net/manual/en/ref.image.php[/url]
---
Steve
Steve Guest
-
Alvaro G Vicario #3
Re: Adding text to a graphic button
*** Steve wrote/escribió (8 Sep 2004 02:02:51 -0700):
Just a remark: performance increases a great deal if you just generate> See [url]http://www.php.net/manual/en/ref.image.php[/url]
buttons once and store them in a folder, rather than doing it everything
they're loaded from a page.
--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--
Alvaro G Vicario Guest
-
l'atelier Ho #4
Re: Adding text to a graphic button
Many thanks four your quick answer.
I also think it will be faster if I can use a store image. My idee was to
use a stored image (the button) on only add the text on the fly.
I will look about the mentionned GD library, if it's possible do do that.
Regards
Otto
> *** Steve wrote/escribió (8 Sep 2004 02:02:51 -0700):>> > See [url]http://www.php.net/manual/en/ref.image.php[/url]
> Just a remark: performance increases a great deal if you just generate
> buttons once and store them in a folder, rather than doing it everything
> they're loaded from a page.
>
l'atelier Ho Guest
-
John Murtari #5
Re: Adding text to a graphic button
l'atelier Ho <ateho@freesurf.ch> writes:
If you would like to see a 'working' example of> Hello to all,
>
> I have to write some scripts for a web side created with
> Frontpage.
> My customer used some button generated with FP.
> He like that I use the same button in my php scripts. I
> could save a lot of code and time if I could use only one
> graphic button and then add the text on the fly.
>
> My questions, it is possible to do that with PHP. ?
> I should put about 20 buttons in a table something like
> that:
>
> ¦---------¦
> ¦ Button1 ¦
> ¦---------¦
> ¦ Button2 ¦
> ¦---------¦
> ¦ Button3 ¦
> ¦---------¦
> etc.
>
> Many thanks in advance for your help.
>
> Otto
>
some code using True Type fonts, see the stuff at
[url]http://www.thebook-demo.com/php[/url]
--
John
__________________________________________________ _________________
John Murtari Software Workshop Inc.
jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)
[url]http://thebook.com/[/url]
John Murtari Guest
-
Arg #6
Re: Adding text to a graphic button
I have been experimenting with different ways of doing menus and here is
one of them that sounds like what you may be trying to do
[url]http://ncug.net/index2.html[/url]
It doesn't actually use PHP to do anything ( it is an html ) and it is not
optimized yet; I need to use loops in the javascript mouse functions.
I used the same 3 images for all of the buttons (up, down, and clicked) and
then layered the text over the graphics. The text is 2 layers with the dark
layer above and to the left of the top layer of text to make it look more
like it is carved into the button. I need to tweak the fonts a little
better. I then layered a clear gif over the button and text thet reacts to
the mouseover and click. I probably could have just used a span there
instead of the transparent gif.
The fan at the bottom of the menu is made up of 3 gifs layered over each
other, the middle one being the animated frame. The fan rotation is kind of
jerky because I got tired of playing with it and just wanted to get it put
in, I'll make a better one when I get to it.
I have tested this in current versions of Netscape, IE, and Opera. One thing
I see that I need to get changed is the cursor needs to be "pointer" instead
of "hand" as hand does not give you a hand in Netscape and pointer does in
all 3 browsers.
This uses absolute positions for the components of the menu, but the menu as
a whole can be wrapped in a span if you need to move it.
I did a similar menu at [url]http://www.oldenburggroup.com[/url] but there I used an
external .js file to control the button actions and some loops in php to
build the menu. The buttons there have the text on them, so there are 42
images being used.
"l'atelier Ho" <ateho@freesurf.ch> wrote in message
news:VA.00000268.02f5f7ac@freesurf.ch...> Hello to all,
>
> I have to write some scripts for a web side created with
> Frontpage.
> My customer used some button generated with FP.
> He like that I use the same button in my php scripts. I
> could save a lot of code and time if I could use only one
> graphic button and then add the text on the fly.
>
> My questions, it is possible to do that with PHP. ?
> I should put about 20 buttons in a table something like
> that:
>
> ¦---------¦
> ¦ Button1 ¦
> ¦---------¦
> ¦ Button2 ¦
> ¦---------¦
> ¦ Button3 ¦
> ¦---------¦
> etc.
>
> Many thanks in advance for your help.
>
> Otto
>
Arg Guest
-
l'atelier Ho #7
Re: Adding text to a graphic button
In article <10l0jtipc7lev89@corp.supernews.com>, Arg wrote:
Hello Arg> Newsgroups: alt.comp.lang.php
> Subject: Re: Adding text to a graphic button
> Date: Tue, 21 Sep 2004 10:59:42 -0500
>
I find the following solution:
I make the button with png8, you can also use GIF. The only
problem with GIF, some provider do not support it
(Licence!).
Write the following PHP script (button.php):
<?Php
Header("Content-type: images/png");
$im = imagecreatefrompng("$img");
$is = getimagesize("$img");
if(!isset($fs)) $fs=11;
$size =
imagettfbbox($fs,0,"$DOCUMENT_ROOT/fonts/$fn.ttf",$tx);
$black = ImageColorAllocate ($im, 0, 0, 0);
$dx = abs($size[2]-$size[0]);
$dy = abs($size[5]-$size[3]);
$xpad=$is[0];
$ypad=$is[1];
ImageTTFText($im, $fs, 0, ($xpad-$dx)/2, ($ypad+$dy)/2,
$black, "$DOCUMENT_ROOT/fonts/$fn.ttf", $tx);
Imagepng($im);
ImageDestroy($im);
?>
The script calculate the dimension of the picture and the
dimension of the text do display, then center them in x,y.
Include next the following link in your another scripts:
echo("<a href='$ref' target='$targ'>");
echo("<img border='0'
src='button.php?fn=arial&fs=$12&tx=Hello&img=butto n.png'>")
;
Place the necessary fonts in /fonts/ you can use windows
ttf fonts.
Regards
Otto
l'atelier Ho Guest



Reply With Quote

