[SOLVED] Using Image fns in a class
Posted: Mon Jun 14, 2004 11:44 am
Hello
All the image functions are working ok in my scripts so I decided to use classes for these.
I have a file which contains the GenerateImage class.
The class has - function Display($filename)
In the calling script I have :
I tried 3 ways of displaying the image :
1>
2>
3>
Neither is displaying the image. It is displaying the content of the image file like this (first & last few chars shown here)
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC
........
ÿñïþµTÝŒ‚y|ç ·ÆsERÿÙ
I also tried adding header("Content-type: image/jpeg"); in the class/file.
Any idea how to get this working in class ?
Thanks
All the image functions are working ok in my scripts so I decided to use classes for these.
I have a file which contains the GenerateImage class.
The class has - function Display($filename)
Code: Select all
function Display($filename)
{
.
.
.
.and finally
imagejpeg($tmp_img);
// I tried returning imagejpeg($tmp_img),$tmp_img
}Code: Select all
$AlbumThumb=new GenerateImage("somearg");1>
Code: Select all
print('<TR><TD ALIGN=center><IMG SRC='.$AlbumThumb->Display($rowї'url']).'></TD></TR>');Code: Select all
print('<TR><TD ALIGN=center>'.$AlbumThumb->Display($rowї'url']).'</TD></TR>');Code: Select all
$AlbumThumb->Display($rowї'url']);ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC
........
ÿñïþµTÝŒ‚y|ç ·ÆsERÿÙ
I also tried adding header("Content-type: image/jpeg"); in the class/file.
Any idea how to get this working in class ?
Thanks