CodeIgniter Forums
[NEED HELP] imagecreate - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: [NEED HELP] imagecreate (/showthread.php?tid=44088)



[NEED HELP] imagecreate - El Forum - 08-02-2011

[eluser]Unknown[/eluser]
Hello I try to build a library to create and show an image on my webpage.

here the library code :
Code:
class Img_library {
        
public function  __construct() {
}

public function img_show_image() {
header("Content-Type: image/png");
$im = @imagecreate(110, 20)
    or die("Impossible d'initialiser la bibliothèque GD");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
}

}

The code works well when I execute it out of codeigniter folders
example : http://localhost/test.php

but when I put it in the ci library folder and call the library to execute the img_show_image()
its said that it cannot load the image because there's some errors...

please help me if you know how to resolve.


[NEED HELP] imagecreate - El Forum - 08-02-2011

[eluser]Aken[/eluser]
Post the exact error you're receiving, and perhaps the contents of your controller.