PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 14th, 2001, 10:56 PM
php guy php guy is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 8 php guy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
php image gen

I have a counter that displays the count in the form of 5 image files which show the counter on the respective number. Right now i just set the five gifs beside eachother and it looks very unprofessional for them all to load at diferent times, is there a way in php to put each of these five images together into one long image that would represent the whole number?

Thanks!

Reply With Quote
  #2  
Old May 15th, 2001, 02:40 PM
bizzk's Avatar
bizzk bizzk is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Location: The Netherlands
Posts: 327 bizzk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
You can store it in a Java applet (not sure if it works) but you can also try to code (or find) some JavaScript which does the job...

More info on PHP image generation:
http://www.phpbuilder.com/columns/rasmus19990124.php3
http://www.phpbuilder.com/columns/allan20000830.php3
http://www.phpbuilder.com/columns/w...er20001218.php3

Reply With Quote
  #3  
Old May 15th, 2001, 03:45 PM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Central Florida, USA
Posts: 2,306 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 6 h 5 m 10 sec
Reputation Power: 57
Rather than build a complicated script to glue together the image files, why not make use of the GD library to dynamically create the whole image, complete with the numbers? It would be a very simple script, and with that method, you have the freedom to switch between any number of fonts and styles quickly.

The only difficulty can be setting up your server to integrate GD with PHP, but once you do that, GD is very fast and efficient.

I don't see how Javascript would do the job, other than possibly pre-loading all the images, and then making them appear at the same time.
__________________
The real n-tier system:

FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

Amazon wishlist -- rycamor (at) gmail.com

Reply With Quote
  #4  
Old May 15th, 2001, 04:32 PM
php guy php guy is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 8 php guy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm not sure I understand what "GD" means.

I am assuming you mean for me to have php create the entire graphic with its image generation capabilities. Is it possible to add special effects (such as making the numbers appear on fire or making an outline around each number etc.) with php?

thanks!

Reply With Quote
  #5  
Old May 15th, 2001, 05:45 PM
JeffCT JeffCT is offline
PHP & Ruby Developer
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2001
Posts: 1,436 JeffCT User rank is Sergeant Major (2000 - 5000 Reputation Level)JeffCT User rank is Sergeant Major (2000 - 5000 Reputation Level)JeffCT User rank is Sergeant Major (2000 - 5000 Reputation Level)JeffCT User rank is Sergeant Major (2000 - 5000 Reputation Level)JeffCT User rank is Sergeant Major (2000 - 5000 Reputation Level)JeffCT User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 h 36 m 40 sec
Reputation Power: 37
GD is the name of the image generation package in PHP

Reply With Quote
  #6  
Old May 15th, 2001, 06:56 PM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Central Florida, USA
Posts: 2,306 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 6 h 5 m 10 sec
Reputation Power: 57
Go to http://php.net/image for more info.

PHP with GD can do some fairly standard outlines, dropshadows, etc... and if you set it up with TTF support, you can actually drop any of your windows True-Type fonts on the server, to be used in images. GD supports stuff like line drawing, polygons, curves, fills, blends, image layering and transparency (sort of), and text scaling and antialiasing, and output to PNG or Jpeg, among others.

If you want special effects like flames, etc... then you should create a small flame background that is the appropriate size, and you can layer it under the fonts. If you want the flame to model the actual text, though, you should consider just creating small premade images for each number. GD is not intended for effects like that, because they take too much processing power. If you really want to do it dynamically, you can use Gimp to do special server-side effects. (see www.cooltext.com for an example). I do not recommend this for something like a counter, though, because your server will take a beating.

There is also a new image library for PHP called php_imlib, which has some more advanced features than GD, but I haven't tested it yet.

Reply With Quote
  #7  
Old May 15th, 2001, 07:49 PM
bizzk's Avatar
bizzk bizzk is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Location: The Netherlands
Posts: 327 bizzk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Rycamor:

Letting the images appear at the same time: that's exactly the goal that must be achieved. I don't know what is the easiest or the best way, but JavaScript can do the job.

About GD:

I've heard about how great GD is, and I saw some "kewl" examples, but when your hosting company doesn't support it, like mine ("We will consider installing it, when we get more requests") you can't use it. You can check if GD is installed by making a php file with the following content:
PHP Code:
<?php

print phpinfo() ;

?>


I am not an expert on GD, but links the articles on PHPbuilder I posted should help you. There is lots of info on GD (www.boutell.com/gd/ ). If you are seriously interested in PHP you might want to buy a book on it, like "Beginning PHP" from the publisher Wrox, this book has a chapter on image generation. You can find more info about PHP books elsewhere in this forum and on the web (try http://forums.devshed.com/showthrea...13460&forumid=5).

Bizzk

Reply With Quote
  #8  
Old May 15th, 2001, 08:21 PM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Central Florida, USA
Posts: 2,306 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 6 h 5 m 10 sec
Reputation Power: 57
There is a graphics program that is commonly installed on Unix servers: ImageMagick.

If you read the comments on http://php.net/image, you will see a couple of comments about using passthru() to generate a graphic with ImageMagick and output it to the browser. It's not integrated with PHP, but since PHP can just call it from the command-line you can accomplish many of the same tasks with it. If you have a shell account on the server, you might even be able to install ImageMagick yourself, if it's not already there.

Yeah, Javascript can do the job, but php guy seemed to be looking for a PHP solution.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > php image gen


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 7 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek