Solved

working with graphics in PHP3

Posted on 2000-03-29
16
266 Views
Last Modified: 2012-05-04
Hello, everyone!

As I've read from PHP3 official manual (Graphics section), there are functions to work with GIF, etc. files, but to use them I should install GD library... I haven't found a DLL or something like that that I could apply to my PHP3. I'm definately doing something wrong, so I ask if there's a way to solve my problem?

IMPORTANT> I'll rise pts to 200 if anyone can give me that GD 1.8.1 for PHP3 that supports WBMP files!

BW,
[WizzarD].
0
Comment
Question by:wizzard
  • 9
  • 6
16 Comments
 
LVL 8

Expert Comment

by:us111
ID: 2666640
GD library is available at http://www.boutell.com/gd/
If you use winnt or windows you have the php3_gd.dll installed with PHP3
0
 

Author Comment

by:wizzard
ID: 2668234
Wow! khe-khe... ;) Just after reading your comment I've looked in the PHP dir and saw that php3_gd.dll :)
>IMPORTANT It's strange that I could not use these functions, because as it was written in php3.ini file, I should write something like ...*.DLL in order to bind all the dlls in the dir to the PHP and it didn't work, as it seems ;) bug?

The last question is about it's version: If my PHP is of version 3, then the GD lib is of 1.8.1? %-) Is it?

Thanks for help, after your answer I'll grade you!
0
 

Author Comment

by:wizzard
ID: 2668284
And if it's version is newer than 1.6, how can I output an image to the screen? I can't find a corresponding function...
0
 
LVL 8

Expert Comment

by:us111
ID: 2668296
you must uncomment
extension=php3_gd.dll in your php3.ini

then try
<?
phpinfo()
?> in order to see if the library is loaded. Then it should works, it runs for me.

Hmm for your last question I don't know really. It may be the last version or it depends of your php version

You can grade me if you wish:)
I'm gonna install visual basic on my computer, there's a software which allows you to see the content of a DLL. I will tell you which
version of GD is distributed with php 3.0.15.

:)
0
 
LVL 8

Expert Comment

by:us111
ID: 2668305
you wish to output an existing image ?
0
 

Author Comment

by:wizzard
ID: 2668323
Adjusted points from 100 to 150
0
 

Author Comment

by:wizzard
ID: 2668324
BOTH! ;)

<?php
$imgID = imagecreate($width,$height);
ImageFill($imgID, 1, 1, 10);
ImageGif($imgID);
?>

this doesn't work correctly, for this lib doesn't support ImageGif function, it returns an image byte-by-byte ;) :

GIF87a,È€,,Èÿԏ©Ëí£œ´Ú‹³Þ¼û†âH–扦êʶî ÇòL×öçúÎ÷þ ‡Ä¢ñˆL*—̦ó J§ÔªõŠÍj·Ü®÷ ‹Çä²ùŒN«×ì¶û ËçôºýŽÏë÷ü¾ÿ(8HXhxˆ˜¨¸ÈØèø)9IYiy‰™©¹ÉÙéù *:JZjzŠšªºÊÚêú +;K[k{‹›«»ËÛëû ,N^n~Žž®¾ÎÞîþ/?O_oŸ¯¿Ïßïÿ0 À <ˆ0¡Â… :|1¢Ä‰+Z¼ˆ1£ÆM;zü2¤È‘$Kš<‰2¥Ê•,[º| 3¦Ì™4kÚ¼‰3§Î<{úü 4¨Ð¡D‹=Š4©Ò¥L›:} 5ªÔ©T«Z½Š5«Ö­\»þ$P;

I will also need to view existing image with some additions...


0
 

Author Comment

by:wizzard
ID: 2668329
If you could also find 1.8.1 DLL of GD for PHP3 I'd rise points to 300! ;)
for it has WBMP support!
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:wizzard
ID: 2668345
I've tried to output as well to the GIF87a format as to the GIF89a, explorer can't show it, if also I'm trying to output these to file.. :(
0
 

Author Comment

by:wizzard
ID: 2668414
I've found that the version of GD in PHP3 pack is 1.3! It means that ImageGif function should work... but it returns incorrect GIF... :(

If you could find 1.8.1 version DLL file it could be great!

Thanks,
Wizz.
0
 
LVL 8

Expert Comment

by:us111
ID: 2668465
<?php
    Header("Content-Type: image/gif");    
    $imgID = imagecreate($width,$height);
    ImageFill($imgID, 1, 1, 10);
    ImageGif($imgID);
?>

will be better. I haven't really play with the gd library but
the following URL explains you have to use images fucntions with PHP,
I guess it could help you
http://hotwired.lycos.com/webmonkey/99/25/index3a.html?tw=programming

I'm sorry but I can not tell you the GD library version (php3_gd.dll has a lot of dependencies). You may ask this question in the php mailing list.
0
 

Author Comment

by:wizzard
ID: 2668489
Warning: Cannot add more header information - the header was already sent (header information may be added only before any output is generated from the script - check for text or whitespace outside PHP tags, or calls to functions that output text) in C:\InetPub\wwwroot\wlr\sql2web.php3 on line 13

:(((

Ok, if you can't solve this any further, say it and I'll grade you, for you had a good job! ;)
0
 
LVL 8

Accepted Solution

by:
us111 earned 150 total points
ID: 2668577
maybe before
<?php
    Header("Content-Type: image/gif");    
    $imgID = imagecreate($width,$height);
    ImageFill($imgID, 1, 1, 10);
    ImageGif($imgID);
?>
you may have some text (html tag, space....)
when you use     Header("Content-Type: image/gif");    
you cannot put some tag before.
So here the solution

image.ph3
<?php
    Header("Content-Type: image/gif");    
    $imgID = imagecreate($width,$height);
    ImageFill($imgID, 1, 1, 10);
    ImageGif($imgID);
?>

and then your file
<html>
<body>
<img src="image.php3" name="test">
</body>
</html>

now it will work. The webmonkey website explains that.
Of course you give some parameters to image.php3
<img src="image.php3?height=10&width=10" name="test">

but add in the image.php3
<?php
    Header("Content-Type: image/gif");    
    parse_str(QUERY_STRING);
....
...
?>


0
 

Author Comment

by:wizzard
ID: 2668667
Eeee.... Why should I add the parse_str(QUERY_STRING) to the code? In order to use parameters? %-} they work fine w/o that... Perhaps I missed something.. ;)
 Well the trick worked fine, but still don't know how to use more colors than 1 and 0 ;) I'll try to understand how to manage palette myself, but if you have any comments, feel free to ad them here ;)

Thanks
0
 
LVL 8

Expert Comment

by:us111
ID: 2668897
parse_str(QUERY_STRING), this command allows you to use the
parameters, but it may works without that
0
 
LVL 7

Expert Comment

by:cstsang
ID: 2688573
hi wizzard:

  Can you tell me what OS you are using to run this php code?
  It is because I can't display the graphics on my WIN.NT server using similiar php code.
But it's work on my red hat linux server.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
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…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now