示例#1
0
 /**
  * @covers Xoops\Html\Img::render
  * @todo   Implement testRender().
  */
 public function testRender()
 {
     $output = $this->object->render();
     $this->assertStringStartsWith('<img ', $output);
     $this->assertStringEndsWith(' />', $output);
     $this->assertGreaterThanOrEqual(4, strpos($output, 'src="image.png" '));
     $this->assertGreaterThanOrEqual(4, strpos($output, 'class="image" '));
 }
示例#2
0
 /**
  * getImgTag - get a full HTML img tag to display a QR Code image of supplied text
  *
  * @param Response $response   \Xoops\Core\Service\Response object
  * @param string   $qrText     text to encode in QR Code
  * @param array    $attributes array of attribute name => value pairs for img tag
  *
  * @return void  - response->value set to image tag
  */
 public function getImgTag(Response $response, $qrText, $attributes = array())
 {
     $url = $this->getQRUrl($qrText);
     $imgTag = new Img(array('src' => $url));
     $imgTag->setAttributes($attributes);
     $response->setValue($imgTag->render());
 }
 /**
  * getImgTag - get a full HTML tag or string to display a flag based on county code
  *
  * @param Response $response    \Xoops\Core\Service\Response object
  * @param string   $countryCode ISO 3166-1 alpha-2 code to select flag
  * @param array    $attributes  array of attribute name => value pairs for img tag
  * @param string   $size        'small', 'medium' or 'large'
  *
  * @return void  - response->value set to image tag
  */
 public function getImgTag(Response $response, $countryCode, $attributes = array(), $size = 'large')
 {
     $url = $this->getFlagUrl($countryCode, $size);
     if (!is_array($attributes)) {
         $attributes = array();
     }
     $imgTag = new Img(array('src' => $url, 'alt' => $countryCode));
     $imgTag->setMerge($attributes);
     $response->setValue($imgTag->render());
 }
示例#4
0
 /**
  * getImgTag - get a full HTML img tag to display a thumbnail of the supplied image
  *
  * @param Response $response   \Xoops\Core\Service\Response object
  * @param string   $imgPath    path to image to be thumbed
  * @param integer  $width      maximum width of thumbnail in pixels, 0 to use default
  * @param integer  $height     maximum height of thumbnail in pixels, 0 to use default
  * @param array    $attributes array of attribute name => value pairs for img tag
  *
  * @return void  - response->value set to image tag
  */
 public function getImgTag(Response $response, $imgPath, $width = 0, $height = 0, $attributes = array())
 {
     $url = $this->getThumbnailUrl($imgPath, $width, $height);
     $imgTag = new Img(array('src' => $url));
     $imgTag->setAttributes($attributes);
     $response->setValue($imgTag->render());
 }