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




Equal Ratio Image With Netpbm


I'm trying to modify a script I am running for a gallery application. The script creates thumbnails properly, but only changes it based on width, which is a variable supplied in a sql table. I'm trying to modify the script so that it so that the width "and height" are no greater than that variable. Here is what I have so far:

Code:
<?php
function RatioResizeImg($src_file, $dest_file, $gid) {

list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$column = &$pntable['meg_categories_column'];
$query = "SELECT $column[thumbwidth] from $pntable[meg_categories] WHERE gallid=$gid";
$result = $dbconn->Execute($query);
list($newWidth) = $result->fields;
list($newHeight) = $result->fields;

switch(megConfigGetVar('imageSoftware')) {
case 'GD': return RatioResizeImgGD($src_file, $dest_file, $newWidth); break;
case 'ImageMagick': return RatioResizeImgImageMagick($src_file, $dest_file, $newWidth); break;
case 'none': return $src_file; break;
case 'browser': return 'browser' break;
case 'NetPBM': return RatioResizeImgNetPBM($src_file, $dest_file, $newWidth, $newHeight); break;
default: return $src_file; break;
}
}

function RatioResizeImgNetPBM($src_file, $dest_file, $newWidth, $newHeight) {
/* Define where to find the various external binaries we need */
$netpbm = megConfigGetVar('netpbmPath'); /* default: home/www/pcmodeler/netpbm */

$djpeg =$netpbm."/djpeg"; /* decompresses a jpeg to ppm */
$cjpeg =$netpbm."/cjpeg"; /* compreses a ppm to jpeg format */
$pnmscale = $netpbm."/pnmscale"; /* scales a ppm image */
$pnmscale = $netpbm."/pnmscale"; /* scales a ppm image */
$jpgtopnm = $netpbm."/jpegtopnm"; /* convert a jpg to ppm */
$giftopnm = $netpbm."/giftopnm"; /* convert a gif to ppm */
$pngtopnm = $netpbm."/pngtopnm"; /* convert a png to ppm */
$ppmtojpg = $netpbm."/ppmtojpeg"; /* convert a ppm to jpg */
$ppmtogif = $netpbm."/ppmtogif"; /* convert a ppm to gif */
$ppmquant = $netpbm."/ppmquant"; /* colour quantize a ppm */

/* $imginfo = @getimagesize($src_file);
if ($galleryvar['imageSoftwarePath'] == '')
$cmd = $galleryvar['imageSoftwarePath']."/";
else
$cmd = "";
*/

if(!file_exists($dest_file)) {
if(ereg(".gif$",$src_file)) { /* Look for .gif extension */
exec("$giftopnm $src_file | $pnmscale -width $newWidth ".
"| $ppmquant 256 | $ppmtogif -interlace > "$dest_file"");
} elseif(ereg(".jpe?g",$src_file)) { /* Look for .jpg or .jpeg */
exec("$jpgtopnm $src_file | $pnmscale -xysize $newWidth $newHeight".
"| $ppmtojpg > "$dest_file"");
} elseif(ereg(".JPE?G",$src_file)) { /* Look for .JPG or .JPEG */
exec("$jpgtopnm $src_file | $pnmscale -xysize $newWidth $newHeight".".
"| $ppmtojpg > "$dest_file"");
} elseif(ereg(".png",$src_file)) { /* Look for .png */
exec("$pngtopnm $src_file | $pnmscale -xysize $newWidth $newHeight".| ".
"| $ppmquant 256 | $pngtopnm > "$dest_file"");
} else { /* not a GIF, PNG or JPG file */
return("");
}
}
return $dest_file;
}

?>

So far, I can't get it to modify the width, so that portrait images are no larger than the variable. What am I missing?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Resizing Pics On The Fly With NetPbm
I need thumbnails to be dynamically and instantly created on the fly. My server supports GD and NetPbm. I tried a program that uses GD but the pictures looked aweful!
Is there a way, using PHP and NetPbm that I can call an image like this:

<img src="thumb.php?image=pic.jpg&height=20>

So that a 20 pixal high jpg thumbnail of pic.jpg is returned?

Using NetPBM To Generate Thumbnail Images.
I need to be able to accept a gif/jpeg image upload and then:

1.) Save it into a database.
2.) Create a thumbnail of the uploaded image and save it to a database.

I am able to upload an image directly into a database, but I'm having trouble trying to generate a thumbnail of the image. It just shows up as a broken image.

Here is my test code that I'm using to try to develop this feature. You pass the id# of the image in the database and it should retrieve the image, make a thumbnail of it, and then display the thumbnail. All I get is a broken link though. Can somebody point out my mistakes? Code:

Displaying Images In A Ratio
Instead of fixing the images height/width, can I have it show by a ratio of the original size?

What I have is a large image and want to make a small "preview" of it (without creating another file), at the moment I just set it to 80x80pixels but the problem with this is if the large image isn't square it looks squashed. Is it possible to do it by a ratio?

Images And Aspect Ratio Help Needed
I'm trying to figure out how to write some php code that will allow me
to resize a .jpg image and maintain it's aspect ratio -

Ordering A Table From A Ratio Worked Out By Data In SQL
I have a SQL database that stores wins and losses, what I wish to do is order it in a table, so the people with the BEST ratio are at the top.

I don't know how to do this, at the moment it's just ordered by the most wins, then the ratio on the end of the table worked out using some basic PHP. Here is my code:

Two Equal Strings?
I was just checking php.net but couldn't find a function that will compare to strings.

Did I just overlook it? or do I have to write a function to compare the two stirngs in php?

If there is a function, which one is it?
If there isn't a function, could you give me an idea of the coding that would compare two strings?


When To Use 2 Equal Signs And When To Use 3
When I had these two lines in my code:

if ($executed == "The command didn't exist") {
$this->core->error("In CommandRenderAllActionsInAnArray we sought
the command '$commandName' but ExteriorCommands could not find it. It
returned the value: '$executed'.", "CommandRenderAllActionsInAnArray");

I was getting this on screen:

# CommandRenderAllActionsInAnArray threw this error: In
CommandRenderAllActionsInAnArray we sought the command
'checkToSeeIfThisIsTheFirstLogin' but ExteriorCommands could not find
it. It returned the value: &#391;'.

But if I change the first line to this:

if ($executed === "The command didn't exist") {

then it works correctly.

Why does this need 3 equal signs? Why doesn't 2 suffice? I've done
string comparisons before and I've never had to use 3 equal signs
before.

Strcmp Vs Equal
I noticed in some examples to the encrypt functions of the PHP manual a
syntax was used for password checks such as

if (strcmp($userpassword, md5($_POST['password'])) == 0) {
// do login
}

What is the advantage of this compared to

if ($userpassword == md5($_POST['password'])) {
// do login
}

?

Making Fields Equal
I have two tables in a database and I have an html form. The tables both include a field called id# and that's how I have linked the tables in my SQL statement. I would like to set up my form so that when someone enters an id# it will write the value to the id field in both tables. Does anyone have any idea how I'd go about doing this?

How Can One Variable Equal 2 Things?
I'm having a problem that is baffling me... say I set a session variable
as so:

$_SESSION['temp'] = "default";

Now if I test the following two conditionals:

if($_SESSION['temp'] == "default")

and

if($_SESSION['temp'] == 0)

they both return TRUE. I don't understand why this is... if anything, I
would have thought testing if it == 1 would be a boolean true since the
variable exists and is not NULL, but testing if == 1 returns FALSE.

Display A Div Only If A Value In Database Is Equal To 1
Im trying to get a div to to only display if the the row in the database called "stock" is equal  to "1" if it is equal to "0 " then do not display the specific div.
Here is the code:

Two Variables, Equal Values - ?
After seeing a script programmed by a user in the beta-test section, I copied its premise - a man vs. dragon battle, with random damage being done.

It just takes random numbers each time the page loads for damage values. That's all it does. However, whenever I play it, the end HP for both man and dragon are exactly the same.

I need 2 things done, or at least to know how to do them -

1) I need to know how to fix the equal-HP problem
2) I would like it if someone could tell me how to achieve the effect of a
<br>...tag within a PHP script.

Here's the script! Code:

Equal Height Columns With 1px Border
I need content boxes equal height with 1 px border, i tried this one http://www.positioniseverything.net...ple/equalheight , but i think it doesnt work standard for a 1px border, is it a good idea to measure the text with php to solve this?

Make Function Equal To String In Conditional
I can usually figure something out, but I CANNOT figure this one out: This is a classified word ad script to count the words in a text area ($wrdad) and multiply it by the rate for how many times the ad will run in the newspaper.  I know my code is messy and ameture, don't be too critical, but it works - everythign except one part. We have a 15 word minimum. I have this area commented out as //Problem Area/// in the code below.

In a nutshell, I want function wordcount($wordad) to be equal to 15 if there are fewer than 15 words in the $wordad textarea. It just seems to ignore the wordcount($wordad) == 15; in my conditional. Code:

Check Date From Input Must Greater Or Equal Today Date?
I have 3 select box. Code:

<select name="day">
<option value="1">1</option>
<option value="2">2</option>
.......
<option value="31">31</option>
</select>

<select name="month">
<option value="01"> Jan </option>
<option value="02"> Feb </option>
.....
</select>

<select name="year">
<option value="2002">2002 </option>
<option value="2003">2003</option>
</select>

When I select and click submit in form. I will have 3 variable :

$day, $month and $year

How can I check the day that I choose in form must equal or greater than today date? If it less than today date. I must print error message to user.

Making Gmdate Output Equal Date Output
gmdate('F j, Y, g:i a',0) returns January 1, 1970, 12:00 am.
How do I add to the second parameter of the date function to make it
always return that same date, regardless of the time zone?
Intuitively, it seems like date('F j, Y, g:i a',0 - date('Z')) should
do it, but on my system, that's an hour off.

Here's some sample code:

<?
echo gmdate('F j, Y, g:i a',0).'<br />'
echo date('F j, Y, g:i a',0 - date('Z')).'<br />'
echo date('F j, Y, g:i a',0 - date('Z') + 60*60);
?>

And here's the output on my system:

January 1, 1970, 12:00 am
December 31, 1969, 11:00 pm
January 1, 1970, 12:00 am

Will the last echo always return the same thing as the first echo,
regardless of the time zone? If so, why? It seems that the second one
is the one that should do it - not the first one.

In Email Form How Do We Say "must Be Equal To X"?
we are getting a lot of spam through our PHP Feedback form, and have set
up a new field 'prove you're human', asking them to do some simple maths.

What is the command for the PHP script itself, to say "this field must be
equal to 9 or return the error page"?

How Do I Get The Image Height Width When Generating Image From PHP (getimagesize Does Seem To Work)
Is it possible to obtain the width/ height of an image when that image
is dyanically created using a PHP script and passing GET attributes.
For example:

<img src="images/showImage.php?image_id=5" />

My images are created from images stored on the server, their paths
stored on in database table and retrieved using the GET image_id and
PHP script (showImage.php). Because the images are different sizes I
would like to be able to use a PHP function / class that can take an
image path and generate the IMG width and height attributes. This
would just tidy up the page when loading.

So when I try to use PHP 'getimagesize' like so:

$wh = getimagesize ($_SERVER['DOCUMENT_ROOT'] . "/images/showImage.php?
image_id=5");

.... I get an error saying that the file or directory does not exist:

Warning: getimagesize(/customersites/0/home/httpd/vhosts/
mydomain.co.uk/httpdocs/images/showImage.php?image_id=5): failed to
open stream: No such file or directory in /customersites/0/home/httpd/
vhosts/mydomain.co.uk/httpdocs/classes/html.class.php on line 11

I thin it may be the GET atttribute that is throwing it. How would I
go about doing this?

Determine Image Information On Image Stored In MySQL BLOB
I store images in my DB as BLOB. When I want to place them in an html
table, I want to determine the width of the image in order to asign the
correct width to the column inside table.
For JPEGs this is working fine, this is my code:

$image = @imagecreatefromstring($r["foto"]);
return @imagesx($image);

where $r["foto"] is the field selected from the db which contains the image.

For GIFs however, its getting really on my nerves !!
I know imagecreatefromstring is not supported in gd2 and I tried several
thinks. None of them worked ! :
-
$temp = tmpfile();
list($width, $height, $type, $attr) = getimagesize($temp);
echo $attr;

gives me :Warning: getimagesize: Unable to open 'Resource id #6' for reading
-
$handle = fopen("/tmp/tmp.dat", "w+");
fwrite($handle, $r["foto"]);
list($width, $height, $type, $attr) = getimagesize($handle);
echo $attr;

gives me : Warning: getimagesize: Unable to open 'Resource id #6' for
reading
-
Doing this with imagecreatefromgif($temp); wont work either !

Can somebody help me out please? by telling me what I'm doing wrong or what
I should do.

Script To Post A Placeholder Image If Image Is Not Found On Server
I'm creating a site with an archive of photo galleries, and on each gallery page i'm looking to have a sidebar that shows a cross-section of other galleries in groups of 10, via thumbnails... except that sometimes, the updated galleries won't actually be there yet, so i'd like to have a script that basically looks for "set053/001.jpg", and if that image hasn't been uploaded, then a placeholder image saying "coming soon" would be shown. Ugh, that's a horrible descrition. Here's the outline of it:

-Say there are 52 photo sets (updates will be made regularly).
-If you're on any gallery between 1 and 10, this "sidebar" will show thumbnails of the other galleries within that group of 10.
-On a gallery between 11-20, you'll see the sidebar thumbnails for galleries 11-20... and so forth.
-But on the most recent set of 10, in this instance galleries 51-60, the galleries 53 thru 60 haven't yet been uploaded, so having a static sidebar that shows "galleries 51-60" would yeild broken images for the thumbs for 53 - 60 right now.

So hopefully that made more sense... basically, if PHP can find "set053/001.jpg" on the server, it shows it. If it can't, then have it show something like "images/comingsoon.jpg".

Writing A Blob Image Out To A File - Jpg Image Looks Weird?
I've got simple watermarking working. I write a Blob image out from my db to a temp file and then overlay the watermark image to create 1 whole image.

The watermark is perfect, but the exported blob behind it looks all garbled - parts are visible but its not right!

I've looked at the temp file thats created by the line "fwrite($t_img, $data);" and the image looks corrupt, but displaying this field using usual php methods the blob looks fine.....

Here's the code :-

@MYSQL_CONNECT("$server","$user","$password");
@mysql_select_db("$database");
$query = "SELECT image, mime_type, image_width, image_height FROM items WHERE ID='$id'";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0,"image");
$type = @MYSQL_RESULT($result,0,"mime_type");
$image_width = @MYSQL_RESULT($result,0,"image_width");
$image_height = @MYSQL_RESULT($result,0,"image_height");
// Write blob data out to temp image file to prep for Watermark
// creating a temp image name
$t_img_name = tempnam ("./temp", "timg");
$t_img = fopen($t_img_name, "w");
// $content is the blob field with the image.
fwrite($t_img, $data);
fclose($t_img);
//-$size = getimagesize($t_img_name);
//echo $size[0]." - ".$size[1];
$img = imagecreatefromjpeg($t_img_name);
$watermarkImage = 'images/watermark2.png'
$x = 165;
$y = 130;
imagesetbrush($img, imagecreatefrompng($watermarkImage));
imageline($img, $x, $y, $x, $y, IMG_COLOR_BRUSHED);
imagejpeg($img);
// End of watermark protection
// don't forget to delete the temp file after all.
//unlink($t_img_name);
$type = "image/jpg";
if(strlen($data) < 1) {
header("Location: ./images/nopicsubmitted.jpg");
} else {
//header("Content-type: $type");
header("Content-Type: application/octet-stream");
echo $img;
}

Can anyone spot if i've made a mistake, used wrong function or syntax etc?

Resize Uploading *.gif Image For Image Display And Thumbnail
how to resize the uploading *. gif image...for display image size and thumbnail size...Okay I know how to do a uploading image...only for resizing part kind of lost it...because I find all tutorial not suit for what I look after..Ok the idea is..

when I upload image ..the php will resize the image into two type size and put into two folder "folder for images" and "folder for thumb" and size for all this type of image are...images = 100x100 thumb = 80x80 with same name file.

How Do You Detect Image MIME Type Of An Image In A Directory?
How do you detect an image MIME type if you know of the image in a
directory? For example, I know of:

Code: ( php )

Creating Watermark With Another Image & Resizing Watermarked Image
I have a script that watermarks an image; it adds a transparent gif over my base image. I also have a script to resize my image. But here is where the problem comes in; these are two different scripts - none of the code will interconnect (variable wise - that is), so I am having a problem trying to piece together a PHP GD Image code that will create a watermark and will then be resized. Below is my code for resizing my image, but from there - I know I need to use imagecreategif somewhere and imagecopy somewhere; but where, I do not know. Code:

Getting Image (binary) From DB --> How To Make A 'true' Image
I'm storing images in a table as binaries (blobs)..now getting them out again to display them is no problem. What I want to do is get them out of the DB and using functions like getimagesize and such on them to make a thumbnail and dump that back in a separate table.
PHP Code:

Store Image On Datatable And Show Image
Store Image on datatable and show image. How could i store an image on table and show?

Get Image From DB Fails. Image Are Not Returned Correctly.
I have a problem retreiving images from a MSSQL 2000 database with php. I wrote an ASP page using "response.binarywrite" to get the same image, and this worked 100%. Therefore, the images in my database is not corrupt.
Only the top part of the image is returned to the client's browser window. Same result with both IE6 and Opera 7.11.
I guess the problem is header related, and I've tried to output different headers with no luck whatsoever.

Here is my php code:

getimagefromdb.php
-----------------------
<?php
error_reporting(E_ERROR);
header("Content-type: image/jpg");
$sql_servername = 'name_of_dbserver'
$sql_user = 'sql_user_name'
$sql_userpw = 'sql_user_password'
$db = 'database_name_where_images_is'

$query = "SELECT coverImage FROM dvds WHERE id = ".$_GET['ID'];
if (false != $conn = mssql_connect($sql_servername,$sql_user,$sql_userp w)) {
mssql_select_db($db,$conn);
$rs = mssql_query($query,$conn);
$arrImage = mssql_fetch_row($rs);
mssql_close($conn);
echo $arrImage[0];
}
?>

Next is a simple example of a page requesting image with ID=1:

index.php
-----------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
</head>
<body>
<table>
<tr>
<td>
Image: <img src="getimagefromdb.php?ID=1" />
</td>
</tr>
</table>
</body>
</html>

Creating Image From Uploaded Image And Transparent PNG
Say the client wants to be able to change the image, but not the text treatment, and doesn't have the Photoshop knowledge to actually replace it and re-save it themself.

Is there anyway to use a PNG with the rounded edges, text treatment, and transparent center, have the client upload a standard rectangular-shaped image, and use PHP to layer the uploaded image underneath the transparent one, creating a new image file?

Building An Image Tag Using An Image From A Diffrent Site
I am trying to edit a code so that images that are placed using a wysiwyg editor (live linked) would display, as of now only images residing on your server that are are displayed.

What would I change so that it could assemble the tag from anywhere, not only from my site ($mosConfig_live_site)? Code:

Image Upload Problem - New Image Not Displaying
I have a consistent problem that needs knocking on the head. I have an image upload script that uploads an image and replaces the old image. The image that is displayed is sometimes that old image and the page must be manually refreshed to get the new one. I need the new image to be displayed with out have to manually refresh the page.

So far I have identified the following:

•   Ive been testing in ie and firefox – the problem only happens in firefox.

•   If the upload script is activated more than once it works as desired – but not the first time. I need it to work the first time.

•   I have set the page to automatically refresh. – this works in ie, but firefox still needs a manual refresh.

•   I’ve included the following which makes no difference:

•   header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
•   header("Cache-Control: no-cache");
•   header("Pragma: no-cache");

Imagejpeg Generating String Not Image Even With Header("Content-type:image/jpeg")
does anyone know why i can't generate images with:
header("Content-type:image/jpeg");
imagejpeg($img_number);

i've tried different examples but i always get a text output as if the
header doesn't make a difference at all.

<?php
//random_number.php
$img_number = imagecreate(100,50);
$white = imagecolorallocate($img_number,255,255,255);
$black = imagecolorallocate($img_number,0,0,0);
$grey_shade = imagecolorallocate($img_number,204,204,204);

imagefill($img_number,0,0,$grey_shade);
ImageRectangle($img_number,5,5,94,44,$black);
ImageRectangle($img_number,0,0,99,49,$black);

header("Content-type:image/jpeg");
imagejpeg($img_number);
?>

Imagemagick - Position A Image On Top Of Another Image
I am trying to put a small transparent gif or png image in the top left corner of my images with imagemagick.

Image Handling & Image Quality
I'm using php to resize images on the fly but the quality diminishes for some reason.
These are the only image functions that I use:

$src = ImageCreateFromJpeg($image);
$dst = ImageCreate($tn_width,$tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0,
$tn_width,$tn_height,$width,$height);
header("Content-type: image/jpeg");
ImageJpeg($dst, null, -1);

Could you tell me what the problem might be?

How To Create An Image From A Php Image.
I am trying to create an image from a .php. I was thinking of using fread and fopen, but I would like to use the GD libary. Any thoughts?

Image In Image String
I am using the imagestring function, where a string of text is displayed over an image.
PHP Code:

Loading One Image On Top Of Another Image
I want to load an image and position it over another background image before sending it to the browser (I think the example I saw before involved a treasure map and a set of co-ordinates marking where a flag was to be put). I can use imagecreatefromgif(), but I can't see how to add the second image. Any suggestions?

Headers For "image Not Found" Image
I'd like to serve an image-not-found image for images... that aren't
found..
I'm already using a custom 404 handler page.. but this question could
apply to images retrieved from a database or script or whatever...

Anyhow, is the 1st method OK, or should #2 be used?
ie, does the client/bot or whatever recognize the 404 on method 1?
Or, does it think everything is dandy because of the redirect.

header('HTTP/1.0 404 Not Found');
header('location: '.$image_url);
exit;

or

header('HTTP/1.0 404 Not Found');
header('Content-Type: image/whatever');
readfile($imagefilepath);
exit

is one way more better?

Image Map Help
I have a small map that is divided into 4 areas. I also have 4 checkboxes for each area. I want to allow the user to click on anywhere in the specific area and it will check/uncheck the appropriate checkbox. I am not really sure where to start. Any help would be great.

Image In Url
How do i add an image in the url address bar.. is this done by php or html?

PHP Image Map
I know HTML, but not PHP (and now our site is in PHP). I wanted to make an image in my header a link. I know how to do an image map in HTML, but not in PHP.

The header code where the image is, looks like this:

<?
$pid = "4";
$banner_img = "banner_blog.jpg";
$banner_alt = "Blog";
$callback = $baseurl."blog/";
$rootdir = "../";
$disableCSS = "yes";
?>

So how can I add something like: "usemap="#banner_blog" to the PHP code so it knows which image map to use?

Image Png?
just updating a part of my site that used to use imagegif to now use imagepng however the png being output is losing its transparency? the original image copied into it has a transparence but the output png does not, there seems to be no second parameter in imagepng($im) like in imagejpeg so what have i missed out?

How To Put One Image On Another With GD
I have on e 100x100 and one 200x200 images. Ai want to comose them one on other, whoe to do tha ? That should be with GD + PHP.

Getting Image As GIF
I am new to images, and I work with a list of files - which for other reasons is a list of gif files (I test for $file.gif). I have found imagecreatefromgif and getimagesize which does pretty much what I need. Though, can I convert other images to GIF? I took a look and did not find that much... something like save image...

Image Url
I was wondering if there is code or a php application that will have the
ability to punch in a URL address in a form and click submit once you have
done that it will list all the images and folders being used on that site.

so lets say the user types in http://www.msn.com

after you hit submit it will list and show all the images that are being
used by msn.

GD Image
Is there a way to take the height of an image and depending on the height find the width that corresponds to it by a ratio and cut out any extra width? Then take that image and resize it to a desired width/height, that is the same ratio. Code:

Image To Swf
is there a way to convert an image file to SWF (flash) using PHP only.

PhP In An Image
What do I need to put PhP into an image, is there a program that I could use?

How To Put An Image In PHP Using Img Src?
I've been doing a code that will transfer a file to another folder and preview it before adding it to the MYSQL database. Code:

Creating An Image
I am making a links page for my site that takes the links out of the database and displays the name on a button, but the text on each button is different lengths and I was wondering if there was a way I could align them center on the button?

This is the button.php code:
<?php
header ("Content-type: image/png");
$string = $_GET['text'];
$im = @imagecreatefrompng ("button1.png");
$text_color = imagecolorallocate ($im, 255, 255, 255);
imagettftext($im, 10, 0, 5, 35, $text_color, "c:phpfontsariblk.ttf", "$string");
imagepng ($im);
imagedestroy($im);
?>


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