Copyright © 2005-2008 Andrea Tincani

AndreaPHP | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Class v.s. Procedural)Next Topic (Problem with a SQL class...) New Topic New Poll Post Reply
AndreaPHP Forum : PHP General : Problem with ImageCreateFromJPEG
Poster Message
neutrall
Level: Scholar


Registered: 28-03-2004
Posts: 43

icon Problem with ImageCreateFromJPEG

I'm currently doing a image reconition class, but I get getting the error  :

Fatal error: Call to undefined function ImageCreateFromJPEG() in J:\WEBSITE\WWW\class\RandomImageText.php on line 27

The code on line 27 is the Line with the ImageCreateFromJPEG :

<?php
function RandomImageText($jpeg$fheight 10$fWidth 10)
    {
        
$this->image ImageCreateFromJPEG($jpeg);
        
$this->iHeight ImageSY($this->image);
        
$this->iWidth ImageSX($this->image);
        
$this->fHeight $fHeight;
        
$this->fWidth $fWidth;
        
$this->xPos 0;
        
$this->fonts = array(2345);
    }
?>


Can anyone give a hand ?


[Edited by neutrall on 12-05-2005 at 10:38 AM GMT]

____________________________
A Stick give a wise man something to think about... and a fool, something to put in is mouth.

29-04-2005 at 04:16 AM
View Profile Send Email to User Show All Posts Visit Homepage ICQ | Quote Reply
neutrall
Level: Scholar


Registered: 28-03-2004
Posts: 43

icon Re: Problem with ImageCreateFromJPEG

Again, I found the error!!!!

I only needed to include the extension=php_gd2.dll  in the PHP.ini file!!!


(Have you ever had the feeling you're talking alone!!!)

____________________________
A Stick give a wise man something to think about... and a fool, something to put in is mouth.

29-04-2005 at 04:57 AM
View Profile Send Email to User Show All Posts Visit Homepage ICQ | Quote Reply
~Bean~
Level: Big Cheese


Registered: 07-04-2003
Posts: 22

icon Re: Problem with ImageCreateFromJPEG

LOL...no I just saw your post and I might have known the answer....but GJ figuring it out.

One word about the JPEG's and GD I have had some funky things happen with the JPEG when I alter them in PHP...basically they get blurry and distorted. I am not sure why, and I havent gotten an answer from those I have asked, but I started using the PNG format and the clarity is back to normal...weird...

P.S.
Good to see you OOPing it up in PHP!





____________________________
Eggheads unite! You have nothing to lose but your yolks.

29-04-2005 at 03:10 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
neutrall
Level: Scholar


Registered: 28-03-2004
Posts: 43

icon Re: Problem with ImageCreateFromJPEG

quote:
P.S.
Good to see you OOPing it up in PHP!


I figure, if I am to learn PHP, might as well do it right!!!

I still got a other question, and I'm happy to hear that someone work with those function before.

How can I get the iamge to show up in my code where I want it to.  I can have the image show up on top of the screen, but all the rest of the code stop. So I only have my text reconition image on screen. If I place the image after something was already echo to the screen. I see the image in text format?...

Does anyone have a clue?



____________________________
A Stick give a wise man something to think about... and a fool, something to put in is mouth.
29-04-2005 at 03:22 PM
View Profile Send Email to User Show All Posts Visit Homepage ICQ | Quote Reply
~Bean~
Level: Big Cheese


Registered: 07-04-2003
Posts: 22

icon Re: Problem with ImageCreateFromJPEG

Try adding...


$this->ImageJPEG($this->image,"pic.jpg");


Which should save the image to your server. Then you can reference it as src in <img> tags....

P.S.
I have heard to always use

ImageDestroy($myimage);

when creating images with GD because it keeps the image in memory and can bog down your system...


[Edited by ~Bean~ on 29-04-2005 at 11:32 AM GMT]

____________________________
Eggheads unite! You have nothing to lose but your yolks.

29-04-2005 at 04:32 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
~Bean~
Level: Big Cheese


Registered: 07-04-2003
Posts: 22

icon Re: Problem with ImageCreateFromJPEG

Oh and I am not sure about this cause I havent tried it but you can probably use a "Content JPEG" header on your image script and then just include that file as your src...

So, if your example script were saved as "makeimg.php" you could just put it in img tags like

<img src="makeimg.php">

thus bypassing the saved file thingy

got it?


EDIT:
If the image is static the saved image might be a good idea...but if its dynamic and you want to create on the fly, the above would probably be best...


[Edited by ~Bean~ on 29-04-2005 at 11:48 AM GMT]

____________________________
Eggheads unite! You have nothing to lose but your yolks.

29-04-2005 at 04:47 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
neutrall
Level: Scholar


Registered: 28-03-2004
Posts: 43

icon Re: Problem with ImageCreateFromJPEG

I did it with the :


$this->ImageJPEG($this->image,"pic.jpg");



and it work (Proof : http://membres.lycos.fr/landsoftimes/signup.php))

But I think that my problem was finding where to place the header information to use the

<img src="makeimg.php">



hmmm...

I think that now I understand...

If I got it right,

I created a php file just with the code to show the image with the JPEG header.
Than I use the HTML img tag to include the file just like a include statement in php...

I'm eager to try it tonight (I'm at work!)  

____________________________
A Stick give a wise man something to think about... and a fool, something to put in is mouth.

29-04-2005 at 10:24 PM
View Profile Send Email to User Show All Posts Visit Homepage ICQ | Quote Reply
~Bean~
Level: Big Cheese


Registered: 07-04-2003
Posts: 22

icon Re: Problem with ImageCreateFromJPEG

Yeah give it a try...I did end up trying it and it does work...
http://www.b34n.com/public/php/gd/gd_test.php

PHP Image
(Content header MUST be the first thing on the page...whitespace and even Session commands can cause issues!)

<?php
Header("Content-type: image/jpeg");
$pic=ImageCreate(100,100);
$col1=ImageColorAllocate($pic,128,128,128);
$col2=ImageColorAllocate($pic,255,0,0);
ImageFilledRectangle($pic,1,1,50,50,$col2);
Imagestring($pic, 2, 5, 75, "PHP Rocks!", $col2);
ImageJPEG($pic,"",90);
ImageDestroy($pic);
?>


The HTML

<html>
<head>
</head>
<body>
Here's the Image...
<img src="makeimg.php" border=0>
Nice, eh?
</body>
</html>


like I said, perhaps best used if you're creating on the fly and dont want to have to worry about misc files sitting on your server...



____________________________
Eggheads unite! You have nothing to lose but your yolks.

29-04-2005 at 11:43 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaPHP Forum : PHP General : Problem with ImageCreateFromJPEG
Previous Topic (Class v.s. Procedural)Next Topic (Problem with a SQL class...) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: AndreaVB

Copyright © 2005-2008 Andrea Tincani

Powered by: tForum tForum Edition b0.92p1
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team.