» Texteffekte mit PHP: imagettftext mit Umrandung / Rand

Texteffekte mit PHP: imagettftext mit SchattenNeuen Thread eröffnenNeue Antwort erstellenimagettfbbox Alternative: imagettfbox
AutorNachricht
Administrator 

Name: Marc
Geschlecht:
Anmeldedatum: 28.08.2004
Beiträge: 52423
Wohnort: Lohmar


Meine eBay-Auktionen:
19.11.2008, 21:31
zitieren

Hi,

neben diesem Schatteneffekt:
http://www.programmierer-forum.de/texteffekte-mit-php-imagettftext-mit-schatten-t80468.htm

habe ich es jetzt noch geschafft einen Umrandungseffekt zu realisieren.

Hier die Funktion:
function imagettfborder($im, $size, $angle, $x, $y, $color, $font, $text, $width) {
// top
imagettftext($im, $size, $angle, $x-$width, $y-$width, $color, $font, $text);
imagettftext($im, $size, $angle, $x, $y-$width, $color, $font, $text);
imagettftext($im, $size, $angle, $x+$width, $y-$width, $color, $font, $text);
// bottom
imagettftext($im, $size, $angle, $x-$width, $y+$width, $color, $font, $text);
imagettftext($im, $size, $angle, $x, $y+$width, $color, $font, $text);
imagettftext($im, $size, $angle, $x-$width, $y+$width, $color, $font, $text);
// left
imagettftext($im, $size, $angle, $x-$width, $y, $color, $font, $text);
// right
imagettftext($im, $size, $angle, $x+$width, $y, $color, $font, $text);
for ($i = 1; $i < $width; $i++) {
// top line
imagettftext($im, $size, $angle, $x-$i, $y-$width, $color, $font, $text);
imagettftext($im, $size, $angle, $x+$i, $y-$width, $color, $font, $text);
// bottom line
imagettftext($im, $size, $angle, $x-$i, $y+$width, $color, $font, $text);
imagettftext($im, $size, $angle, $x+$i, $y+$width, $color, $font, $text);
// left line
imagettftext($im, $size, $angle, $x-$width, $y-$i, $color, $font, $text);
imagettftext($im, $size, $angle, $x-$width, $y+$i, $color, $font, $text);
// right line
imagettftext($im, $size, $angle, $x+$width, $y-$i, $color, $font, $text);
imagettftext($im, $size, $angle, $x+$width, $y+$i, $color, $font, $text);
}
}

Erklärung:
$width = Randstärke in Pixel

Beispiel:
// settings
$font = '../fonts/GeosansLight.ttf';
$text = 'Programmierer-Forum.de';
// image
header("Content-type: image/gif");
$im = imagecreate(400, 50);
// colors
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$red = imagecolorallocate($im, 255, 0, 0);
$grey = imagecolorallocate($im, 175, 175, 175);
$blue = imagecolorallocate($im, 0, 0, 255);
// display text
imagettfborder($im, 20, 0, $border, 30, $grey, $font, $text, 3);
imagettfborder($im, 20, 0, $border, 30, $white, $font, $text, 2);
imagettftext($im, 20, 0, $border, 30, $blue, $font, $text);
// display image
imagegif($im);
imagedestroy($im);

In diesem Beispiel habe ich 2 Ränder gesetzt. Einen der 3 Pixel breit ist und einen der 2 Pixel breit ist darüber. Dadurch bleibt vom 3 Pixel breiten Rand nur noch 1 Pixel übrig und die Schrift wirkt noch plastischer. Viel Spaß beim Herumprobieren!


 
schrift-ohne-umrandung.gif
schrift-ohne-umrandung.gif - Angeschaut: 4505 mal

 
schrift-mit-umrandung.gif
schrift-mit-umrandung.gif - Angeschaut: 4507 mal

pn email
Gast 
19.11.2008, 21:31
zitieren

Mach mit!

Wenn Dir die Beiträge zum Thread "Texteffekte mit PHP: imagettftext mit Umrandung / Rand" gefallen haben oder Du noch Fragen hast oder Ergänzungen machen möchtest, solltest Du Dich gleich bei uns anmelden:



Registrierte Mitglieder genießen die folgenden Vorteile:
✔ kostenlose Mitgliedschaft
keine Werbung
✔ direkter Austausch mit Gleichgesinnten
✔ neue Fragen stellen oder Diskussionen starten
✔ schnelle Hilfe bei Problemen
✔ Bilder und Videos hochladen
✔ und vieles mehr...


Neuen Thread eröffnenNeue Antwort erstellen
Ähnliche BeiträgeRe:
Letzter Beitrag
 Texteffekte mit PHP: imagettftext mit Schatten
Hallo, ich habe hier eine Funktion realisiert, die einen TrueType-Schriftzug mit einem Schatten ausstattet. Hier die Funktion: function imagettfshadow($im, $size, $angle, $x, $y, $font, $text, $width, $frcolor, $bgcolor=false,...
[PHP]von mgutt
0
9.010
19.11.2008, 16:39
mgutt
 Texteffekte mit PHP: imagettftext mit Verlauf / Farbverlauf
Hallo, neben Schatten und Umrandung , konnte ich jetzt auch einen Farbverlauf realisieren. Einziger Haken im Moment ist, dass kein Antialias unterstützt wird. Ich musste Antialias ausschalten, damit die Schriftfarbe komplett entfernt werden...
[PHP]von mgutt
0
2.206
20.11.2008, 15:50
mgutt
 Schrifteffekte: Verlauf, Schatten & Umrandung im Einsatz
Hier ein Beispiel, wenn man die folgenden Effekte...
[PHP]von mgutt
0
1.077
20.11.2008, 16:00
mgutt
Box an den rechten Rand
Moin! ich habe mir eine eigene Softwarebox gebaut: <onlyinclude> &#123;| class="float-right wikitable infobox" id="vorlage-infobox-Name" summary="Infobox Name" style="Tabellen-Attribute" |-...
von jan99
0
73
26.09.2014, 10:49
jan99
Rand und Bett verchromen
Hallo leute, will kreuzspeichen felgen erst lackieren und dann das bett und den rand auf hochglanz polieren.. mit was fange ich zu erst an? erst polieren dann lacken oder andersrum? die felgen sind einteilig.. wie mach ich das bett wie...
von semih37
0
257
07.04.2011, 01:35
semih37
Zwei auser Rand und Band...
http://www.youtube.com/watch?v=kHtb9QryDZc...
von FG-Driver
7
971
18.09.2009, 17:47
Agent-Smith
Einpresstiefe vs. Backspacing (Raum bis zum inneren Rand)
Hi, ich bin gerade verwirrt, was der Einfluss von Einspresstiefe auf das Backspacing anbelangt. Einpresstiefe ist mir klar. Wem nicht, hier lesen: Bei einer Einpresstiefe von 0 ist die Mitte der Reifenlauffläche symmetrisch zur Befestigungsebene...
von mgutt
10
1.937
26.07.2010, 19:33
mgutt
Foto für Leinwand, das aber keinen Rand zulässt?
Ich habe hier das Foto und wollte eigentlich wie immer einen Leinwanddruck mit 2cm Rand nehmen. Allerdings bietet das Foto keinen Raum für einen Rand und würde doof aussehen. Daher frage ich mich nun was ich machen könnte. Jemand eine Idee? Vielleicht...
von mgutt
5
432
23.12.2015, 09:03
mgutt
© 2004 - 2025 www.programmierer-forum.de | Communities | Impressum |