Example #1
0
 private static function decode_background($background)
 {
     $parts = explode(',', $background);
     $parts[0] = Image::decode_color($parts[0]);
     if (count($parts) == 1) {
         return array($parts[0], null, 0);
     }
     $parts[1] = Image::decode_color($parts[1]);
     return $parts;
 }
Example #2
0
 /**
  * Convert the thumbnail into a IMG element.
  *
  * @param array $attributes
  *
  * @return \Brickrouge\Element
  */
 public function to_element(array $attributes = array())
 {
     $w = $this->w;
     $h = $this->h;
     $src = $this->src;
     if ($src instanceof \Icybee\Modules\Images\Image) {
         $alt = $src->alt;
         $size_reference = array($src->width, $src->height);
     } else {
         $alt = '';
         $size_reference = \Brickrouge\DOCUMENT_ROOT . $src;
     }
     list($w, $h) = \ICanBoogie\Image::compute_final_size($w, $h, $this->method, $size_reference);
     $class = 'thumbnail';
     $version_name = $this->version_name;
     if ($version_name) {
         $class .= ' thumbnail--' . \Brickrouge\normalize($version_name);
     }
     return new Element('img', $attributes + array('src' => $this->url, 'alt' => $alt, 'width' => $w, 'height' => $h, 'class' => $class));
 }