Solved

GD blurry text with imagettftext in php

Posted on 2004-08-04
8
1,099 Views
Last Modified: 2012-06-22
I am making online virtual "name tags" for my coworkers.   I am using php/mysql with GD to put their names on a  name tag image.   I have been getting complaints that the text on the badges is blurry especially at lower resolutions (I didnt notice because I'm half blind and at 1280x1024)  the ONLY solution I've seen is to put the text on an image of 2x the size and reduce it.   This seems like a clever solution, but not something I want to do unless I have to.    If it IS the only solution I would appreciate some advice on simple formulas to change how my text is positioned so that It will work on the doubled image.

I am using the gd with php and the version is        bundled (2.0.23 compatible)

0
Comment
Question by:hibbidiji
  • 4
  • 4
8 Comments
 
LVL 27

Expert Comment

by:Diablo84
ID: 11721759
I had a similar problem before when using imagejpeg() after using imagettftext, i tried using imagepng() instead and had better output so this might be worth trying for you if the option is available.

http://www.php.net/manual/en/function.imagepng.php
0
 
LVL 1

Author Comment

by:hibbidiji
ID: 11721985
The question would be this:  If I send a JPEG header then send a PNG image isnt this a problem?   Wouldnt there potentially be cross browser potential incompatibilities?
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11722017
>> If I send a JPEG header then send a PNG image isnt this a problem?   Wouldnt there potentially be cross browser potential incompatibilities?

having never tried this before i can not give you a definative answer.

can you not output the image as a png or does it have to be in jpg format?
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 1

Author Comment

by:hibbidiji
ID: 11722039
I really need to output as JPEG because these images are being delivered to the workers via email and most of their email clients will probably only read jpegs
0
 
LVL 27

Accepted Solution

by:
Diablo84 earned 500 total points
ID: 11739296
actually the vast majority of email clients do support png's, off the top of my head i know outlook and mozilla thunderbird do, in addition to this i know hotmail does.

If png is definitely not an option then i think creating the picture double size and then halfing it may be the only option, unless i can think of another way of working around it...
0
 
LVL 1

Author Comment

by:hibbidiji
ID: 11741467
I've got a few messages into the GD mailing list.   There is a new version out.  While I know that the PHP version of GD is different, I'm going to see if the latest version will do me any good.
0
 
LVL 1

Author Comment

by:hibbidiji
ID: 11750249
I am going with the 2x solution. There really isnt another one that will work properly for my purposes.  thankyou!
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11751197
quite alright, sorry i couldnt help you more on this one.

good luck,

|)iablo
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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 create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

823 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