| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * @file 5 * Theme functions for the video module. 6 * 7 */ 8 9 function theme_video_thumbnails($file, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) { 10 $file = (array)$file; 11 // return $file['filepath']; 12 if (!is_file($file['filepath'])) { 13 return '<!-- File not found: '. $file['filepath'] .' -->'; 14 } 15 16 if ($getsize) { 17 // Use cached width and height if available. 18 if (!empty($file['data']['width']) && !empty($file['data']['height'])) { 19 $attributes['width'] = $file['data']['width']; 20 $attributes['height'] = $file['data']['height']; 21 } 22 // Otherwise pull the width and height from the file. 23 elseif (list($width, $height, $type, $image_attributes) = @getimagesize($file['filepath'])) { 24 $attributes['width'] = $width; 25 $attributes['height'] = $height; 26 } 27 } 28 29 if (!empty($title)) { 30 $attributes['title'] = $title; 31 } 32 33 // Alt text should be added even if it is an empty string. 34 $attributes['alt'] = $alt; 35 36 // Add a timestamp to the URL to ensure it is immediately updated after editing. 37 $query_string = ''; 38 if (isset($file['timestamp'])) { 39 $query_character = (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE && variable_get('clean_url', '0') == '0') ? '&' : '?'; 40 $query_string = $query_character . $file['timestamp']; 41 } 42 43 $attributes['src'] = file_create_url($file['filepath']) . $query_string; 44 $attributes = drupal_attributes($attributes); 45 return '<span></span><img '. $attributes .' />'; 46 } 47 48 function theme_video_widget_preview($item) { 49 return theme('filefield_widget_preview', $item); 50 } 51 52 function theme_video_widget_video_thumb($item = NULL) { 53 return '<div class="video-thumb">' . theme('video_image', $item, '', '', '', FALSE) . '</div>'; 54 } 55 56 /** 57 * @defgroup "Theme Callbacks" 58 * @{ 59 * @see uploadfield_theme(). 60 */ 61 function theme_video_image($file, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE, $imagecache = FALSE) { 62 $file = (array)$file; 63 //if this is imagecache skip this as the file might not be created yet 64 if (!$imagecache && !is_file($file['filepath'])) { 65 return '<!-- File not found: '. str_replace("--", "-", $file['filepath']) .'" -->'; 66 } 67 68 if ($getsize && $imagecache && ($image = image_get_info($file['filepath']))) { 69 $attributes['width'] = $image['width']; 70 $attributes['height'] = $image['height']; 71 } 72 elseif ($getsize) { 73 // Use cached width and height if available. 74 if (!empty($file['data']['width']) && !empty($file['data']['height'])) { 75 $attributes['width'] = $file['data']['width']; 76 $attributes['height'] = $file['data']['height']; 77 } 78 // Otherwise pull the width and height from the file. 79 elseif (list($width, $height, $type, $image_attributes) = @getimagesize($file['filepath'])) { 80 $attributes['width'] = $width; 81 $attributes['height'] = $height; 82 } 83 } 84 85 if (!empty($title)) { 86 $attributes['title'] = $title; 87 } 88 89 // Alt text should be added even if it is an empty string. 90 $attributes['alt'] = $alt; 91 92 // Add a timestamp to the URL to ensure it is immediately updated after editing. 93 $query_string = ''; 94 if (isset($file['timestamp'])) { 95 $query_character = (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE && variable_get('clean_url', '0') == '0') ? '&' : '?'; 96 $query_string = $query_character . $file['timestamp']; 97 } 98 99 $url = file_create_url($file['filepath']) . $query_string; 100 $attributes['src'] = $url; 101 $attributes = drupal_attributes($attributes); 102 return '<img '. $attributes .' />'; 103 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |