Example #1
0
 /**
  * Outputs the image to browser
  * 
  * Sets headers Content-length and Content-type, and echoes the image in the specified format.
  * All other headers (such as Content-disposition) must be added manually. 
  * 
  * Example:
  * <code>
  * WideImage::load('image1.png')->resize(100, 100)->output('gif');
  * </code>
  * 
  * @param string $format Image format
  */
 function output($format)
 {
     $args = func_get_args();
     $data = call_user_func_array(array($this, 'asString'), $args);
     $this->writeHeader('Content-length', strlen($data));
     $this->writeHeader('Content-type', WideImage_MapperFactory::mimeType($format));
     echo $data;
 }
Example #2
0
 /**
  * Outputs the image to browser
  * 
  * Sets headers Content-length and Content-type, and echoes the image in the specified format.
  * All other headers (such as Content-disposition) must be added manually. 
  * 
  * Example:
  * <code>
  * WideImage::load('image1.png')->resize(100, 100)->output('gif');
  * </code>
  * 
  * @param string $format Image format
  */
 function output($format)
 {
     $args = func_get_args();
     $data = call_user_func_array(array($this, 'asString'), $args);
     if (function_exists('mb_strlen')) {
         $byteCount = mb_strlen($data, '8bit');
     } else {
         $byteCount = strlen($data);
     }
     $this->writeHeader('Content-length', $byteCount);
     $this->writeHeader('Content-type', WideImage_MapperFactory::mimeType($format));
     echo $data;
 }