Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

working with graphics in PHP3

Posted on 2000-03-29
16
Medium Priority
?
310 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
[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
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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 600 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

715 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