Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Php Text Image

Posted on 2011-09-21
2
Medium Priority
?
264 Views
Last Modified: 2012-05-12
Hello Experts,

I am creating a menu using the Franklin Condensed Font...

I have tried fontface but it renders diferently to the screenshot I produced in Photoshop.

I like the "smooth" option used in photoshop on this font, so I tried to recreate it using this php script...
<?php
// Set the content-type
header('Content-Type: image/png');

// Create the image
$im = imagecreatetruecolor(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $black);

// The text to draw
$text = 'COMPANY PROFILE';
// Replace path by your own font path
$font = 'franklin.ttf';


// Add the text
imagettftext($im, 10, 0, 10, 20, $white, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>

But as you can see from the screenshot... the output image is of a poor quality next to the photoshop screenshot...

Any Ideas??
 PHP and Photoshop Output
0
Comment
Question by:maccaj51
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
Scott Madeira earned 2000 total points
ID: 36574387
I assume you are trying to use the script to dynamically create the menu each time.  If so, I'd recommend that you make the images in Photoshop and use them on the web site.  It will cut down on the processing required by the server to build your menus.

If I missed the boat on this one, let me know what your end goal is....

For image quality, you may want to play with the imagequlaity parameter.  Higher quality will make a bigger file.  There is a trade-off invovled.  imagejpeg() has a default quality of 75 (out of 100.)
0
 

Author Closing Comment

by:maccaj51
ID: 36579127
Cheers... I think im going to create them in PS
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question