CodeIgniter Forums

Full Version: [NEED HELP] imagecreate
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

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

El Forum

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