php.de

Zurück   php.de > Webentwicklung > PHP-Fortgeschrittene

PHP-Fortgeschrittene Arbeiten mit PHP ohne Einschränkungen

Antwort
 
LinkBack Themen-Optionen Thema bewerten
Alt 23.07.2010, 23:59  
Erfahrener Benutzer
 
Registriert seit: 05.02.2009
Beiträge: 1.356
PHP-Kenntnisse:
Fortgeschritten
Destruction ist zur Zeit noch ein unbeschriebenes Blatt
Standard [Erledigt] imagettftext - Textbox ?

Moin,

kann ich mit einer image - Klasse so etwas wie eine Textbox erstellen?
Das heißt ich sagen der kasten ist 400px breit und 100px hoch und da soll dann der Text umgebrochen werden falls er drüber hinausgeht usw. usw.

Würde das ansonsten einfach mit wordwrap + explode machen, dass ich dann nach einer bestimmten anzahl von Zeichen eine neue Zeile beginne.

Würde mich über Hilfe freuen.

Danke
Grüße
__________________
"Dummheit redet viel..Klugheit denkt und schweigt.." [Amgervinus]
Destruction ist offline   Mit Zitat antworten
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 24.07.2010, 01:29  
Neuer Benutzer
 
Registriert seit: 22.07.2010
Beiträge: 10
PHP-Kenntnisse:
Anfänger
affe loco befindet sich auf einem aufstrebenden Ast
Standard

Meinst du sowas? PHP: imagettfbbox - Manual <- Allgemein die Funktion und den Beitrag auf den ich verlinkt hab beachten!
affe loco ist offline   Mit Zitat antworten
Alt 24.07.2010, 02:00  
Erfahrener Benutzer
 
Registriert seit: 05.02.2009
Beiträge: 1.356
PHP-Kenntnisse:
Fortgeschritten
Destruction ist zur Zeit noch ein unbeschriebenes Blatt
Standard

Zitat:
Zitat von affe loco Beitrag anzeigen
Meinst du sowas? PHP: imagettfbbox - Manual <- Allgemein die Funktion und den Beitrag auf den ich verlinkt hab beachten!
Jep sowas meine ich.
Leider funktioniert die Funktion bei mir nicht ( kein Zeilenumbruch vorhanden ).

edit.:
Habe was gefunden
PHP-Code:
<?php
// Path to our font file
$font 'arial.ttf';
$fontsize 10;

// array of random quotes
$quotes = array(
"Did you hear about the guy whose whole left side was cut off? He's all right now.",
"There was a sign on the lawn at a drug re-hab center that said 'Keep off the Grass'.",
"Police were called to a daycare where a three-year-old was resisting a rest.",
"A hole has been found in the nudist camp wall. The police are looking into it.",
"When a clock is hungry it goes back four seconds.",
"Time flies like an arrow. Fruit flies like a banana.",
"Local Area Network in Australia: the LAN down under.",
"Alcohol and calculus don't mix so don't drink and derive.");

// generate a random number with range of # of array elements
$pos rand(0,count($quotes)-1);
// get the quote and word wrap it
$quote wordwrap($quotes[$pos],20);

// create a bounding box for the text
$dims imagettfbbox($fontsize0$font$quote);

// make some easy to handle dimension vars from the results of imagettfbbox
// since positions aren't measures in 1 to whatever, we need to
// do some math to find out the actual width and height
$width $dims[4] - $dims[6]; // upper-right x minus upper-left x 
$height $dims[3] - $dims[5]; // lower-right y minus upper-right y

// Create image
$image imagecreatetruecolor($width,$height);

// pick color for the background
$bgcolor imagecolorallocate($image100100100);
// pick color for the text
$fontcolor imagecolorallocate($image255255255);

// fill in the background with the background color
imagefilledrectangle($image00$width$height$bgcolor);

// x,y coords for imagettftext defines the baseline of the text: the lower-left corner
// so the x coord can stay as 0 but you have to add the font size to the y to simulate
// top left boundary so we can write the text within the boundary of the image
$x 0
$y $fontsize;
imagettftext($image$fontsize0$x$y$fontcolor$font$quote);

// tell the browser that the content is an image
header('Content-type: image/png');
// output image to the browser
imagepng($image);

// delete the image resource 
imagedestroy($image);
?>
Quelle: http://www.phpfreaks.com/tutorial/php-add-text-to-image

Das ist zwar nicht ganz das was ich mir gewünscht hatte ( das wäre meine Notfalllösung gewesen wenn ich es selbst gemacht habe [ siehe Post #1 ] ) aber naja... Man kann nicht alles haben *gg*

Danke
cu
Grüße
__________________
"Dummheit redet viel..Klugheit denkt und schweigt.." [Amgervinus]

Geändert von Destruction (24.07.2010 um 02:13 Uhr).
Destruction ist offline   Mit Zitat antworten
Antwort


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Text aus textbox in Textbox trix0matrix9 PHP Tipps 2010 12 18.04.2010 01:07
[Erledigt] Enter in Textbox abfangen theparasit PHP-Fortgeschrittene 3 24.03.2010 00:47
Textbox füllen mit bestimmten String ASommer JavaScript, Ajax und mehr 6 26.03.2009 12:17
[gelöst] - imagettftext - $x wird ignoriert! stefanjann PHP-Fortgeschrittene 13 22.10.2007 13:14
Textbox per Checkbox füllen tinchen HTML, Usability und Barrierefreiheit 22 29.08.2006 18:13
Alternative zu imagettftext() gesucht pit62 PHP Tipps 2006 8 09.03.2006 12:36
[Erledigt] Problem mit imagettftext(); PHP-Fortgeschrittene 3 08.03.2006 18:21
Textboxen abhängig von Textbox, Checkbox und Radiobuttons HTML, Usability und Barrierefreiheit 1 13.01.2006 12:11
textbox wert zuweisen PHP Tipps 2005-2 10 08.09.2005 14:33
Werte in Textbox schreiben? PHP Tipps 2005-2 23 24.06.2005 11:06
[Erledigt] Bei Textbox rand neue Zeile beginnen??[gelöst] HTML, Usability und Barrierefreiheit 2 10.06.2005 09:02
multiline textbox Masteroi PHP Tipps 2005-2 12 05.06.2005 10:45
Array in TextBox ausgeben PHP Tipps 2005 18 12.05.2005 12:07
Verbleibende zeichen in einer Textbox HTML, Usability und Barrierefreiheit 2 18.04.2005 12:01
Wie setze ich den Pfad für ImageTTFtext() ? PHP Tipps 2005 20 23.03.2005 15:05

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
imagettftext center, php textbox, php imagettfbbox, php image text box, php image textbox, http://www.php.de/php-fortgeschrittene/70003-erledigt-imagettftext-textbox.html, imagettftext background color, php image text multiline overlay, php write text in image textbox, textbox php, imagettftext center text, image textbox php, imagettftext zeilenumbruch, imagettftext background, alternative zu imagettfbbox, php image dimension imagettftext, php image write text box, imagettftext baseline, imagettftext standard schriftart, imagettftext und html

Alle Zeitangaben in WEZ +1. Es ist jetzt 14:06 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum