How Do You Generate An Array Of Actual Font Names From Your /fonts Folder In PHP?
Consider my code:
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Changing Font Size Of GDF Fonts Over PNG Image
I used imagecreatefrompng("ur.png"), and created a png image. And used imagestring($im, $fontgdf, $leftPos, $height, $text, $txtcolor); to write over the png image. I downloaded and used gdf fonts. Function imagestring() does not take fontsize as parameter, therefore i could not change the font size.
Postcript Library And Fonts - Printer Embedded Font
Ok..am about to embark on making PHP generate basic formatted reports to a postscript printer attached to the server. After many struggles I have the postscript extensions installed and have been reading the documentation to at least eliminate the most basic stupid questions. One stupid question remains: How do I select a (printer) embedded font?...
Read True Type Font (ttf) Tags (font Name...)
I try to acces to the font name of my ttf fonts using a php script with the file name. I've found a script reading idv tags from mp3 files, but it's too specific. Can anyone say me how to read a ttf file in php ?
[GD] Could Not Find/open Font - Font Problem
I know this subject was up several times but Icant get it work use gd2 on win32 <? putenv('GDFONTPATH=f:swdfont'); $font = "f:/swd/font/arial.ttf"; $im = imagecreate (250, 28); $black = ImageColorAllocate ($im, 0, 0, 0); $yellow = ImageColorAllocate ($im, 235, 235, 51); ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font, "comming text or not?"); ImagePNG($im,test.png); ?> <img src="test.png" alt="image"> but I allway get error about not finding font ..
Changing Variable Folder Names To Php Variable
Let me just show you quickly what I mean: The site url: http://www.nothing.com/vr/ will then redirect to http://www.nothing.com/index.php?sec=vr I'm just wondering if this is possible. The folder after the domain isn't an actual folder, but rather a pseudo one, which is then used in a varible. Another example: http://www.nothing.com/test/ -> http://www.nothing.com/index.php?sec=45&desc=test The "folder" has to be variable and so cannot be an actual folder.
Array: Re-generate The Key List?
I have a script that read information from a directory (using scandir()), and puts it in an array. Now I want to filter out all files and unvalid directories (ie: '.' and '..'), so that I keep the normal/visible directories. Than I loop through the array with a while(isset($array[$i])). When I use array_filter() to filter out the unwanted files/directories from the array, it will also delete the keys. So the keys arent for instance: 0, 1, 2, 3, 4, 5 but: 2, 3, 5 When I loop through the array it will say: key 0 (in the beginning, when $i = 0) is not set and so it will stop. How can I re-generate the keys so there wont be gaps between the numbers?
File Names Into Array
right so im in the midst of creating a gallery for a friend of mine, i have most of it right, but when i get the file names from the directory and into an array i have the ".." and "..." as the first two elements, any ideas? my getImages functions is simply as follows: #PHP function getImages() { global $images; $mydir = opendir(images); for($i=0; $i<10; $i++) { $entryname = readdir($mydir); $images[] = $entryname; echo("<br>"); } #PHP
Need Column Names, Not The Array Key...
I am running a script that exports a MySQL table into an excel file. The problem I am having is the column (header) names are not showing up in the final .xls file. I instead get the key value 0, 1, 2, etc. Here is the section of the code that should write the actual names. I can't figure out what's wrong. It looks good to me. Am I missing something? Code:
Duplicate Variable Names In The URL Need To Be Put Into An Array
I have a url with duplicate variable names and I need them to be dumped into an array. For example if I have http://www.google.com?boo=0&boo=1&boo=2 I want to have an array that is boo[0] = 0, boo[1] = 1, boo[2] = 2 How do I do this? I know $_SERVER['argv'] will grab everything after the '?' in the URL, but I don't know what do from there.
Create Array(?) Of Subdirectory Names
I want to output an RSS feed based on text in identically named files located in different subdirectories (at the same level). So the structure looks something like: /dir/subdir1/text.txt, /dir/subdir2/text.txt, /dir/subdir3/text.txt, etc. Therefore, how can I create an array of these subdirectory names, and then loop through those directories to echo the text.txt content?
Updating Images But Names Come From Array
I have an array with a list of image name in it.. (the images are on the server) This images are displayed in a foreach loop, on a page with a option to update the image, BUT the names of the image on the server must stay the same...below is the code as I have written it up to know, it does not work it only updates (maybe the last image in the array) Code:
Javascript Is Not Accepting Array Form Names
I was doing a PHP project and want the elements in array to be named as id[2], id[4] etc. When I tried to validate those form fields using javascript as: document.formname.id[6].value an error occurs.....
Getting Actual Url?
is there any way to get the actual called URL into a variable? I am not thinking of 'http://'.$_SERVER['HTTP_HOST'].$_SERVER["SCRIPT_NAME"].':'.$_SERVER["SERVER_PORT"] because this obviously does not differ e.g. between http: and https: or perhaps a user:pass-combo included in the url...
Setting Variable Names Using Field Names?
I'm having trouble creating dynamic variables using field names. Basically I got a heap of fields named after Players and I want to grab the field name and make a variable called it while assigning it a value from a post variable which is also the player name. This is the code I'm using: $result=mysql_query("SELECT * FROM playerstats"); while($fld = mysql_fetch_field($result)) { if ($fld->name!='match_id' && $fld->name!='opponent' && $fld->name!='map') { $fld->name=$_POST[$fld->name]; } }
Echo The Actual Variable Name
i sit here thinking, and wondering... say for example i have a variable called $definition_london Say for exaple that has not set value... Is it possible to echoe thew ACTUAL variable name into a document, rather than the variables information?
Email Sending From Address To Be Actual Sender's
I am using a script to send an email to me whenever someone registered in my custom make PHP script site. Following is the extract of the email sending function of my code. The problem is I need this script to send the mail where from address should be the actual user’s address (i.e. if marcel34@hotmail.com register a new account I need this system to send the following mail that should look like coming from [email] $FromName = $Email; $ToEmail = $listmail; $Message = " Please subscribe me User Name : " . $UserName . " Mailing : " . $Mailing . " Name : " . $CustomerName . " Email : " . $Email . " .....
Loop Through Array And Create Variable Session Variable Names
As part of my user authentication class I've written a method that sets session variables. I pass an array to the function by reference which contains elements populated with information from the users table in the DB (name, street, country etc) At the moment the function looks like this: /* Set the session variables for easy access to user data */ function _setSessionData(&$userData) { $_SESSION['loggedOn'] = true; // Logged on $_SESSION['userID'] = $userData['UserID']; $_SESSION['username'] = $userData['UserName']; $_SESSION['password'] = $userData['Password']; $_SESSION['firstName'] = $userData['FirstName']; $_SESSION['surname'] = $userData['Surname']; $_SESSION['email'] = $userData['Email']; $_SESSION['street'] = $userData['Street']; $_SESSION['city'] = $userData['City']; return true; } What I'm wondering is if it is possible to loop through the $userData array, and dynamically name and populate the session variables rather than listing them all and assigning like I have?
Help: GD, PHP, And Fonts..
I am having problems with imageloadfont() function, does anyone have a good link with explaination on how to use this function? I tried the php manual, but it's useless, I tried loading the font: $i = imageloadfont("font.bmp"); but it gives me an error saying "error loading font".. anybody know how to create the font? I dont think we can use TTF, the function accepts a bitmap font..any idea what that is? I used a program that creates bitmap font, which saves it to a .bmp file, and this file didnt work (for the above function, but view as image, it does work).
Using Fonts And Gd
I would like to use gd to edit an image and add some text,i am using PHP Version 4.3.8 and i am using the following code. <?php $im = imagecreatefrompng('bars/title_test.png'); putenv('GDFONTPATH=usr/www/users/mimi7818/fonts/'); $fontname="HIROSHT"; $texttobeadded = "test text for button"; $x = 10; $y = 100; $color = imagecolorallocate ($im, 249,255,0); imagettftext ($im,50,0,$x,$y,$color,arial,$texttobeadded); header ('content-type: image/png'); imagepng ($im); ?> i get this error Warning:# imagettftext(): Could not find/open font in /usr/www/users/mimi7818/add_text_to_bar_image.php on line 10 1.please could you tell me what is wrong? 2.is the gdfontpath absolute or relative? if so how do i find out the correct path? 3.do i need to include .ttf in my font name?
Gd + Ce Ttf Fonts
Is there a way to get Central European specific characters (croatian, to be specific) out of ttf fonts (arial, tahoma, verdana etc) in pictures generated with GD library? Right now I'm getting squares and blanks.
Using Ttf Fonts
At the risk of many coffee splashed monitors . Can I upload a ttf font called font.ttf in the website folder and use that exact font to display certain text on the webspace . I've had good on php.net and this is closest I got . ----- void swf_definefont ( int fontid, string fontname ) The swf_definefont() function defines a font given by the fontname parameter and gives it the id specified by the fontid parameter. It then sets the font given by fontname to the current font. -----
Gd Fonts
how do you access fonts for GD use? I know locally you use your windows directory to your fonts folder, but online, how do you access true type fonts?
GD Fonts
when you use putenv('GDFONTPATH=C:WINDOWSFonts'); it gets your fonts, but if you were to be using it on a web server you don't want it going back to your hard drive to get the fonts, can you copy the fonts into a folder on your webserver and just reference it there?
Image Fonts
I have written some PHP code to write dynamic text onto a menu bar for my web page, and while it works with the default fonts used by PHP, I cannot get different fonts to load correctly. I have tried to use the ImagePSLoadFont() function, but all I get is the following error message : Call to undefined function: imagepsloadfont() Has anyone here worked with fonts and image creation with PHP? Is this the function I want to use?
Check Fonts
Is there a way to check wich fonts are installed on sombodies browser? if not in php maby in java or something. I need the code for that for a highly customizable graffity wall.
PDF Generation Using Different Fonts..
I have been working with different PDF generation methods where I have found that the classes like PDF.php or FPDF.php supports only some standards fonts. Is there any way or any other classes availble which supports any fonts you like?
Fonts And Image_Graph
I didn't get any replies the first time, so I'm trying again: How do I tell Image_Graph(or Freetype) where to look for fonts? They were installed under /usr/local/, but I still get an error when calling a font. I can hard code the path to the font, so it looks like things are working, but I should be able to call the font by name instead of having to code its path.
GDlib And TTF Fonts
I've managed to use imagettftext() to create a black box with some white text. Is there any way to work out how many pixels wide a particular string is? I'm needing to know whether I should split a string to more than one line if it is longer than the image is wide but I don't know how to do it or even if it is possible.
Remove From $name (folder)/(folder)/[x]/ <-- If Exists To Just Get [x].
I'll be quite honest. I don't have the faintest idea how to do this, while I can do other php without a problem. Once I know how to go about it I'll be okay. It's two things I think? 1. see if there's a trailing slash and delete it. 2. Remove the preceding path to /x, the folders and slashes, and delete them. and then I have x. X by the way is the final folder in a website and this grabs it for me. <? $name = $REQUEST_URI; ?>
Adding Fonts To PHP GD LIbrary
Can anyone tell me in a little detail how to add fonts to my GD Library to cure this error... Warning: imagettfbbox() [function.imagettfbbox]: Could not find/open font in /home/.../testing.php on line 6
Create Image With TWO Fonts
I am using PHP's image creation functions to create dynamic titles on the fly with a corporate logo. Now there are 2 versions of the said logo, a regular ttf and an extra bold ttf. I have found it easy to use one or the other. But what I REALLY want to do is have the first word in one font and the second word in another. But as I dont know how long the first word will be....I dont know how to space the second word. Now there has to be someone out there who has done this or knows how to calculate the spacing. Code:
.php Files - Permissions Are Set Public Readable - So Can Public Get To See Actual Raw File?
As a newbie to PHP is it in anyway possible for a casual web surfer to actually get to see the PHP behind my .php file. E.g. if index.php contained PHP code to check if the page had been called with a variable such as "password", is there anyway a public member can get to see the raw php file and therefore see what the password is? index.php might be: if ($_REQUEST[password]="secret") {[color=blue] >Then show one page[/color] else[color=blue] >show another page[/color] } So if a user visits with index.php?password=secret they get to see the secret page. But as the index.php has to have file permission set so that anyone can read it, I'm worried that the public can just somehow view the file and learn the password.
GD And True-Type Fonts On Windows XP
GD is successfully installed, I can see other images, and if I use ImageString() I can see exactly what I expect. The problem I think is the true-type fonts here almost always have spaces in the names. Am I doing something wrong or is this a known problem? I'm using the latest version of PHP (4.2.3) php_gd2.dll and Apache 1.3.
Using PDFLIB In Windows And Utilising Additional Fonts
We've just pdflib working in Linux, but we also have a windows machine (PHP, MYSQL, APACHE) which we need to get pdflib up and running. Does anyone know how to do this? Lastly how do you get additional fonts to work in PDFLIB? I've got courier, but I was looking for something like Arial?
Unable To View Chinesse Fonts In Firefox!!!!
I'm using Firefox 2.0. When I visit Asian sites, their text renders as strings of question marks. I would like to display the actual characters instead, even if I can't read them. How can I add those character sets to my FF browser? I see a lot of "big-5" (chinese) in my logs. Is there any downside (lost speed or whatever) to doing this?
Can True Type Fonts Be Used To Write Over Png Images
I used imagecreatefrompng("ur.png"), and created a png image. Function imagettftext($im, $fontsize, $angle, $xc, $yc, $txtcolor, $fontfamily, $text); does not work here. Can i use imagettftext() if i create png images using imagecreatefrompng()? Could any one advise.
Captcha Problem With True Type Fonts.
I have this class and it makes a image simple. http://uni-code.com/cap.txt If I comment this line out: imagettftext($this->img, 16, 0, 10, 25, $this->txtcolor , $this->font , $this->str); It works perfectly with a black box, but when i uncomment it the font doesn't want to show up. Server is PHP 5.1.6 It works perfectly on my other server, what could be the problem?
Page Rotator Without Leaving The Actual Page...
I'm trying to write a homepage page rotator. The home page is default.php and I want 3 pages to rotate in that file without leaving default.php or directing to the actual pages I'm rotating... Basically, a content rotator but I want the content to be individual pages. Here is what I have but it seems I have a bug somewhere: <? $pages = array( include(page1.php), include(page2.php), include(page3.php) ); shuffle($pages); $i=0; $number=2; while(list(, $page) = each($pages)) { if ($i>=$number) { break; } echo "$page"; echo '<br>' $i++; } ?> For some reason the pages aren't coming up right in the default.php page.
PS Font
I have been trying to use .pfb fonts (Type 1) to generate dynamic images. However the text in the images is very aliased and blurred. This is of course not because of the font or the font style itself. Please let me know if you have any ideas or opinions about it. Code snippet: $SIZE = 14; $FONT_PATH = "/usr/X11R6/lib/X11/fonts/Type1/hell.pfb"; $FONT = ImagePSLoadFont($FONT_PATH); $im = ImageCreate(100, 100); $white = ImageColorAllocate($im, 255, 255, 255); $gray = ImageColorAllocate($im, 134, 134, 134); // draw ImagePSText($im, $str, $FONT, $SIZE, $gray, $gray, 0, $SIZE,0,0,0,16); ImagePSFreeFont($FONT);
Can You Arc A Font With PHP?
I am writing a program with the GD library and need to arc a font like Photoshop does. I know how to write text, slant a font, etc., but I cannot figure out how to arc it and do other things. Is this possible with PHP?
With Includes / Font Tag
I was wondering how I would be able to strip the <font> tags from a file when I include it so it can take on the characteristics of my own stylesheet instead of the font tag attributes.
PHP Font Boundingbox Help
I'm trying to understand how to work with bounding boxes around text with the GD2 library. I thought I understood the concepts and wrote a simple program to make sure. Here it is: <?php putenv('GDFONTPATH=c:windowsfonts'); $bbox=imagettfbbox(10,0,"arial.ttf","Hello World"); echo "upper left ($bbox[6],$bbox[7])-----upper right ($bbox[4],$bbox[5])<br><br>"; echo "lower left ($bbox[0],$bbox[1])-----lower right ($bbox[2],$bbox[3])"; ?> The idea is for me to find out the bounding box coordinates for a Hellow World message. The output produced has me very confused though. It shows the coordinates as follows: upper left (-1,-10)-----upper right (66,-10) lower left (-1,-1)-----lower right (66,-1) I understand how the lower left coordinate can be -1,-1, and the lower right coordinate seems logical, too. How, though, can the upper coordinates have y values of -10? That's below the baseline! It would seem logical that since I specified a font size of 10 my Y coordinates on the top would be roughly 10 more than the y coordinates of the lower corners. So, I'd expect the upper coordinates to be something like (-1,10) and (66,10). Where is the negative 10 coming from?
Embed A Font
How do I embed a font onto a remote user's machine? Say he dont have a Papyrus but I want him to view the webpage using the Papyrus font.
|