Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Changing Font In PHP Script And Adding PHP Includes


I have the following code, I am unsure of where to add the menu php include and how to change the font. Whenever I insert it somewhere, my website goes blank. Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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.

Dynamic CSS - Changing Font Size
I've written a bit of script that allows a user to change the font size on a web page.  I am aware that this can be done via browser settings, but the client wants the feature on the web page.

My script uses a cookie to keep the users font choice persistent.  However, when I run the script, the web page doesn't recognize the users font choice unless I refresh the page.  Once I refresh the page, everything works fine.

So I'm confused as to why the browser doesn't recognize the font choice right away. Any suggestions? Code:

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.

Fpdf Adding Font Problm
Have anyone experience problem when trying to add font on fpdf (window version) for type1 font?

Adding Font Effects To A Very Small Php Bit
So I have this small PHP bit and I want a red and bold font on the line that says "This post has been deleted by:" but not sure how to get it in there.  Here's the bit:

$post = 'This post has been deleted by:'. $usr;
$ta = array ('post' => $post,);
$db_string = $this->ipsclass->DB->compile_db_update_string( $ta );
$this->ipsclass->DB->simple_exec_query( array( 'update' => 'posts', 'set' => $db_string, 'where' => 'pid'.$pid ) );

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 ..

PHP Includes Vs. Server Side Includes
Up until now I've been using the PHP include(" "); function to parse items such as navigation bars into my web pages. But I've heard a lot about the SSI way to do it, and I was wondering which is better. For example, is SSI faster because the server doesn't have to load the PHP (if it does at all). So which is generally better for that specific task?

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?

Font In GD Library?
Is it possible to select a font in the GD library?

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.

How To Change Font In GD?
How can I change the font in GD?

Add A New Font To Editor
I want to add a new font to the editor(Innovaeditor).. I changed the font name in editor side and add that font in my fonts folder in control panel...
But the name of the font is like this "??"

ImageString: How Do I Use A Font That Is Not One Of The Default 5?
I am playing with imagegd for generating images, and was wondering if there is a way I could use a font that is not one of the default 5? I remember reading somewhere about a TT font library for imagegd, but don't remember the specifics. If someone could point me in the right direction I would appreciate it.

Making PDFs With PHP - How Do I Add Another Font?
Does anyone have experience adding new fonts to FPDF? The package comes with helvetica, times and courier; I'd like to make PDFs that use Copperplate Gothic.

GD & Text / Font Tricks Anyone?
Does anyone know any tricks->(Read: code) for creating different font effects using the GD Lib. I know how to create images using ttf fonts but they all pretty plain and boring. Shading Effects, Glows, Shadows etc?

Fixed Font Size
I making a web site where people can change the font size with a form on
a seperate page. I store the value in session-variables and read them
every time a page is loaded.

I wonder if it is possible to prevent people changing the fontsize with
Mozilla or IE menu's? Can anyone tell me more about this?

Change Font Size
I need a little help in changing the output of a script with the font size, I am using a users online script, but the output of the font is not specified so it comes out as the browser default size. this is the echo statement

// Show all users online
if ($user==1) {echo $user.' user online'} else {echo $user.' users online'}
?>

Is there a way to add something to this to output a differant font size, I am clueless with php, Not even sure if this is the bit of the script that will change this.

Font Path For Images Using A Mac OSX
all can anyone tell me the fontpath for the mac osx, i dont mind for
which font say Arial. It is compulsory for the function: imagefttext.

Change Font GD Extension
I found a tutorial on how to write text onto an existing image, but now I am having trouble changing the font of the outputted text. Code:

Windows -> UNIX Font
i programmed a security image thing, but i programmed it on my computer, so it's taking it's fonts from C:WINDOWSfonts

the webserver i am trying to implement it on is UNIX..can anyone help on what to set the font path at to load a font? and what's a good font to use? i want to use a serif font since the terminal ones are easier to read via bots.

Font Size In Imagestring()
How do you change the font size when using imagestring() ??

I know you can choose between 1 and 5 but since I added in a font, I do not know how to specify the font size

Here is my code:

imagestring($captcha, 5, 20, 10, $string, $colour);

but as soon as i replace the 5 with my $font, it becomes tiny

Change Font Style In PDF-files
I'm trying to change the font style for Tahoma from normal to italic.
I inserted Tahoma and TahomaBD.
But I can't find anything about changing the style, but underline...

Image With Functions And Font Face.
does anybody know how to change font-face in Arial,Verdana etc. when i'm
using image-functions of PHP?

Font-Size is clear to me...
$fontSize=2
imagestring($im, $fontSize, $px, 34+($i*1.2), $line, $orange);

Thoughts On Font-size Control
I have been researching some different techniques to controll font size
on a webpage and offer users a way to easily manipulate the font and
was curious as to what methods others were using/had used in the past
for this sort of thing.

I have been using static point font sizes on a stylesheet. With a
script that swaps out the stylesheet for one with larger point sizes
upon clicking a button. I chose this technique out of all the others I
have seen because it seemed to offer the most compatability with
slightly out of date browers etc. However the built in font controll
from IE, Firefox etc. still wreaks havoc on my sites layout.

I am worried about using em's as I just dont see how to make that work
in conjunction with images that are far less plyable than the text and
other design elements.

is there any way to supress the view>textsize? Has anyone had
success with em's? Or does anyone have an interesting way to tackle
this problem?

To Install A New Font While View Page!!!!
I am working with chinese fonts and experienced the difficulty as a user to view that page in chinese... How can i add (or install )chinese fonts to the user's system while the user try to view that page!!!!

How To Load Font At Client Side?
How to load font at client side..likeIf I am searching keywords "Hindi" in google search engine..So in the result page I can see the fonts are in hindi, even though hindi font is not installed @ my(client) side..

I dont want to install manually @ client side.. It would be directly handeled via server.. (like above example)so how its possible in php?

Imagettftext Error Cannot Open/Find Font
I uploaded the font to a folder I created called fonts, but it doesn't seem to wanna open. I tried CHMOD the file to 777 the folder to 777. I also tried leaving off the .ttf like someone in the manual suggests. No luck. Do .ttf files need to be uploaded in some special manner? (like a perl file).

I basically copied the text from the php site and changed the file path to reflect my arrangement: PHP Code:

Chinese, Japanese Font Issues With Mail
Can anyone provide me the simplest working solution to send mails in a
multilingual website
that too with no issues relating to display of characters, as of now I
have find a solution which is
working quite well, which is to paste a japanese or chinese lang.
sentences to an editor like
dreamweaver in design mode and paste the generated char code eg. #1045
to the database table
to create a mail template, this is working fine but a labour job. Can
you provide me with a more
intelligent solution? such as by setting the charSet or something else
as of I am using the phpmailer class for the purpose...

Encoding/characterset/font Family Confusion
I could use a bit of guidance on the following matter.

I am starting a new project now and must make some decisions regarding
encoding.
Environment: PHP4.3, Postgres7.4.3

I must be able to receive forminformation and store that in a database and
later produce it on screen on the client (just plain HTML).
Nothing special. I do this for many years, but I never paid a lot of
attention to special characters.

A few day ago I discovered that the euro-sign is not defined in all
fontfamilies.
They cannot produce the right sign no matter if I use &euro; or the
hexadecimal equivalent.
After a little research I found I could put font-tags around the euro-sign
with another font-family (Arial in this case) to get the Euro sign.

I am completely graphical impaired, and only understand programmingcode (and
HTML/JavaScript of course) , so this is a weak point on my side, hence this
question.

I target on Europe only at the moment (no need for Chineese
charactersupport)
That said, will the following setup make sense?

Postgresql db encoding scheme: LATIN1
In the headers of all my HTML: content-type: text/html charset: iso-8859-1

A few related questions:
1) Will people be able to copy/paste info from other sources (like
wordprocessing programs and other websites) into my forms?

2) Can I use regular expressions as I am used to (ASCII) in my PHP code?
Will I match e acute, eurosign, etc?

3) Will the roundtrip describe here under have problems with normal expected
european characters?

client copies some text from some source ->
paste in the form ->
receive by PHP ->
insert in Postgresql (or update) ->
retrieve from postgresql ->
display as HTML (with content-type: text/html charset: iso-8859-1)

Is that OK?
Any pitfalls?
Should I maybe use UTF-8?

Font Color In Jpeg Image (nearly) Always Orange
I am trying to run a basic script that displays an existing jpeg image
and writes some text over it. Sounds simple, but I cannot seem to be
able to colour the font correctly. In the example below it should be
black but it comes out orange. In fact, even if I change the colour to
0, 0, 255 it's orange.

I've read in the PHP documentation (the user contributed notes) that
there are issues with jpeg font colouring. But I've not seen any
details. Can anyone shed light on this for me please?

The example code below is called as a function. The $image variable is
a path to the existing image file and the $ttf variable is a path to a
TrueType font. The $text variable contains a text string.

header("Content-type: image/jpeg");
$base_image = imagecreatefromjpeg($image);
$font = $ttf;
$fontcolor = imagecolorallocate($base_image, 0, 0, 0);
imagettftext($base_image, 18, 0, 10, 100, $fontcolor, $font, $text);
imagejpeg($base_image); imagedestroy($base_image);

Color Or Font Size In The Sprintf() Function?
If so can some please show me an example? I would like to use CSS but will use the <font> tag if mandatory.

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?...

Displaying Php Chart Text On My Host Using An Uploaded Font
Hi im trying to get a chart to display using php. I get an error at the
moment when i use the function (or any requiring an uploaded font to be
used):

imagettftext($image, 6, 0, 0, $initial_point, $colorRed, 'Verdana',
$initial_value);

The error stems from the loading of the verdana ('Verdana') font file
which IS uploaded and works locally but for some reason the script cant
find the file on your site so its returning an error. Does anyonw know
what what might be the cause of this? For example I am using a mac to
work locally and then uploading to the php server which is linuz might
i need to use diferent fonts or something on the server?

Create Image For Each Individual Character In A Truetype Font (.ttf)
Is there any possible way to create an individual image for each character in a TrueType font file (.ttf)? Eiether in PHP, or some Windows program that would do it?

PHP Includes
Heres my prob.

Ive got for eg a structure like this.

/index.php
/info.php

/inc/database.php
/inc/header.php
/inc/footer.php

Say index.php includes header.php and footer.php.
Then in header.php that includes database.php and info.php.

I cant get the paths to work and ive completely forgotten how to sort it. Its doing my head in because I cant move forward in the development of the project.

PHP Includes And SEO
I want to use PHP includes for the menus and header on my next site, something like this:

<?php
include ("menu.html");
?>

in the main pages with the menu and headers on a separate files for ease of editing. Just a bit concerned as to whether search engine bots and spiders will be able to index the links and see the content of the include okay.

Includes
when using includes, will suing the full url to the include file make any difference from if ui just used the something like folde/filename?

Includes In Php As Cgi
I am in the process of moving a site to a new server.

On the old server, these two functions:

<?include("header.shtml");?>

and

<?include("footer.shtml");?>

allowed me to successful include a simple header and footer on every
page of the site.

However: on the new server, php is installed as cgi.

What function will allow me to successfully include the header and
footer files with this configuration? The host swears that shtml works
perfectly as an include for the php installed as cgi configuration --
but I cannot get it to work with this standard command.

Includes
i am using an the following code with an include file on every page on my site...

//GET NAME OF THIS PAGE IN CASE CONNECTION FAILS
$failedpage = basename($PHP_SELF);

//INCLUDE THE GENERAL FUNCTIONS PAGE
include("../resources/functions.php");

//CONNECT TO DATABASE
Connectme($failedpage);

what happens here is that the page gets its own name, it includes the functions page which contains the function Connectme which of course connects it to the database. it then calls the function Connectme passing the name of the page the call is coming from as $failedpage.

So the first thing every page does is connect to the database, if the connect fails then there is a clause in the Connectme function which waits a few seconds and then retries. now this works fine but i have noticed something very odd happening in the functions.php.

the function.php is an include file, before it makes the connect in the function Connectme it includes a file called myconst.h which contains all the passwords for the connection to the database. so the include file function.php has an include file myconst.h, with me so far? the myconst.h resides in the same folder as function.php and so the include is simply...

include("myconst.h");

however it fails to find it, if i change the include to...

include("../resources/myconst.h");

which is the same thing as the folder it resides in is called resources, it works? now i'm not mad! i've tested it about 5 times and systematically every time the first fails and the second works!

PHP Includes
Basically I have a layout index page. What I want to accomplish is display my content pages WITHIN my index page and I dont want to use iframes. Code:

<?php
if(strstr($id, "..") || $id[0]=="/") $id = "";
if(empty($id)) $id = "/home/vbd/public_html/home.html";
else { $id = $id . ".html"; }
if(is_file("$id")){ include("$id");
} else include ("404error.html");?>

I'm formatting my links like this: Code: <a href="index.php?id=news">News</a> And heres what's happening, the home page work as it should but none of the links are working.

PHP Includes
I have a configuration file called config.php" that I would like all my pages to have. The problem with it is that I have to include it in all my pages and have to specify the exact directory wherever it's located and I have my files throughout different files in the filesystem and it becomes a tedious job.

So my question is, is there a way to have php include the file on all your pages in a specific directory recursivly or is there an apache setting through .htaccess that can maybe pull this off?

Using Includes
I have set up my includes outside the public_html directory in directory phpincludes.
When I access index.php in public_html the includes work. I also have a second directory inside public_html, dir2 and want to access these same includes.

I've used an .htaccess file to set the path to the includes from public_html. I don't think I need another .htaccess file inside dir2 since I'm under the impression the directives cascade up the root tree. Can someone point me in the right direction. The PHP files are a counter using MySQL. I would like to use them from several different directories.

PHP Includes
Is it necessary to have your file named *.php to use PHP code in it, such as
for includes? Can't any extension be used?

PHP Includes
I don't want to use Server-Side Includes and recently found out about PHP Includes. (I am new to PHP :P) I've heard that it is simple. If you can provide me with a link to a great tutorial on how I should get started, that would be great.

Includes
I have 3 files Index.php, x.php and  login/Login.php in Login.php

<?php require_once "../x.php"; ?>

Index.php
<?php require_once "loginLogin.php"; ?>

when executing Index.php error is Failed opening required '../x.php'
I can of course say <?php require_once "x.php" ?> in Login.php, then Index.php would load fine.. However if I load loginLogin.php independently, x.php would not be found.
So what should I do?


Copyright © 2005-08 www.BigResource.com, All rights reserved