CodeIgniter Forums

Full Version: Create image from png
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have this function in my model: 


PHP Code:
function createBanner($bg){
   $im ImageCreateFromPNG('assets/images/banners/'.$bg.'.png') or die ("I can't find this banner ! Please check again !");
   header'Content-type: image/png' );
    imagepng($im);
    imagedestroy($im);



But I can't display this image... I checked 10+ times name of the banner and all. I deleted cache too .. Any idea ?

If I use controller against model , works... Any idea why ?
You might want to put more error checking into your method.  I can't tell, from your post, what exactly is failing.

The PHP manual shows one way to do this:

http://php.net/manual/en/function.imagec...rompng.php
Try putting error_reporting(-1); ini_set('display_errors', true); before calling your function.

I think the Php function is case sensitive.