Welcome Guest, Not a member yet? Register   Sign In
Create image from png
#1

(This post was last modified: 05-08-2016, 05:24 AM by gaska96.)

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 ?
Reply
#2

(This post was last modified: 05-08-2016, 07:17 PM by twpmarketing.)

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
CI 3.1 Kubuntu 19.04 Apache 5.x  Mysql 5.x PHP 5.x PHP 7.x
Remember: Obfuscation is a bad thing.
Clarity is desirable over Brevity every time.
Reply
#3

Try putting error_reporting(-1); ini_set('display_errors', true); before calling your function.

I think the Php function is case sensitive.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB