• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 325
  • Last Modified:

working with graphics in PHP3

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
wizzard
Asked:
wizzard
  • 9
  • 6
1 Solution
 
us111Commented:
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
 
wizzardAuthor Commented:
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
 
wizzardAuthor Commented:
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
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
us111Commented:
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
 
us111Commented:
you wish to output an existing image ?
0
 
wizzardAuthor Commented:
Adjusted points from 100 to 150
0
 
wizzardAuthor Commented:
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
 
wizzardAuthor Commented:
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
 
wizzardAuthor Commented:
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
 
wizzardAuthor Commented:
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
 
us111Commented:
<?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
 
wizzardAuthor Commented:
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
 
us111Commented:
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
 
wizzardAuthor Commented:
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
 
us111Commented:
parse_str(QUERY_STRING), this command allows you to use the
parameters, but it may works without that
0
 
KNVB HKSITOCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 9
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now