Exemple #1
0
 function image($image_url, $link_url = false)
 {
     $HTML = Gallery::imageUrl($url);
     $this->HTML[] = $link_url ? Link::url($link_url, $HTML, "id={$this->record_id}") : $HTML;
 }
Exemple #2
0
 function url($url, $size = false, $dimensions = false, $get_still_image = false, $field_name = false, $img_size_persist = false)
 {
     global $CFG;
     if (!is_array(self::$image_sizes) || !$img_size_persist) {
         self::$image_sizes = DB::getImageSizes($field_name);
     }
     if ($size && array_key_exists($size, self::$image_sizes)) {
         $suffix = '_' . $size;
         $dimensions = $dimensions ? $dimensions : self::$image_sizes[$size];
     }
     if (strstr($url, "<embed")) {
         $url = String::getUrlFromEmbed($url);
     }
     $path = pathinfo($url);
     $ext = $path['extension'];
     if (in_array($ext, $CFG->accepted_image_formats)) {
         return "<img src=\"{$url}\" height=\"{$dimensions['height']}\" width=\"{$dimensions['width']}\" />";
     } elseif (in_array($ext, $CFG->accepted_audio_formats)) {
     } else {
         if (strstr($url, "youtube") || strstr($url, 'youtu.be')) {
             if (!$get_still_image) {
                 $url = strstr($url, 'youtu.be') ? str_ireplace('youtu.be', 'youtube.com/embed', $url) : $url;
                 return '<iframe width="' . $dimensions['width'] . '" height="' . $dimensions['height'] . '" src="' . $url . '" frameborder="0" allowfullscreen></iframe>';
                 //return '<object width="'.$dimensions['width'].'" height="'.$dimensions['height'].'"><param name="movie" value="'.$url.'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'.$url.'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'.$dimensions['width'].'" height="'.$dimensions['height'].'"></embed></object>';
             } else {
                 $url = str_ireplace('http://www.youtube.com/v/', '', $url);
                 $url1 = explode('&', $url);
                 $key = $url1[0];
                 return Gallery::imageUrl('http://i2.ytimg.com/vi/' . $key . '/default.jpg', $dimensions, $field_name, true);
             }
         }
     }
 }