CodeIgniter Forums
[NEED HELP] imagecreate - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter Archived (from EllisLab) (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: [NEED HELP] imagecreate (/thread-44088.html)



[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.