Welcome Guest, Not a member yet? Register   Sign In
I can't write on an image
#2

[eluser]Alhazred[/eluser]
Some news.
If I put this code inside a controller the image appears
Code:
function create_img()
{
    $img   = imagecreatefrompng(realpath('static/images/calendar-icon.png'));
    $text_colour = imagecolorallocate( $img, 68, 68, 68 );
    $font_path  = realpath('static/fonts/monosb.TTF');
  
    imagettftext($img, 250, 0, 65, 475, $text_colour, $font_path, '25');

    header( "Content-type: image/png" );
    imagepng( $img );
    imagedestroy( $img );
}

If I put the same code (so it is correct to create and show an image) into a model function and then I call it into a view in this way
Code:
<img src='&lt;?php $this-&gt;my_model-&gt;create_img() ?&gt;' />
on the page appears only the message that the image has some error.

Have you any idea about how to solve this problem?


Messages In This Thread
I can't write on an image - by El Forum - 12-27-2013, 03:59 PM
I can't write on an image - by El Forum - 12-30-2013, 04:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB