title: Convert Image JPG to GIF and print it into the tag IMG in BASE64
body: <p>This is my actual code, I have troubles related with the right visualization of the gif image generated on the fly for my php script. If I access directly to the gif image generated by the script the browser show it good but if I try from my current script through tag img, the browser couldn't show it.</p>
  
  <p>Any suggest friends ?</p>
  
  <pre><code>&lt;?php
  $src = imagecreatefromjpeg( 'img/ejemplo-2.jpg' );
  list( $width, $height ) = getimagesize( 'img/ejemplo-2.jpg' );
  $tmp = imagecreatetruecolor( '300', '300');
  imagecopyresampled( $tmp, $src, 0, 0, 0, 0, '300', '300', $width, $height );
  $imagen = imagegif( $tmp, "filename.gif" );
  $data   = "data:image/gif;base64," . base64_encode( file_get_contents( "filename.gif" ) );
  ?&gt;
  
  &lt;img src="&lt;?php echo $data; ?&gt;" width="300" height="300" /&gt;
  </code></pre>