| 1 |
<?php
|
| 2 |
// $Id: flash_gallery.module,v 1.1.2.2.2.5 2007/04/19 15:37:29 sime Exp $
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
function flash_gallery_help($path, $arg) {
|
| 7 |
switch ($path) {
|
| 8 |
case 'admin/modules#description':
|
| 9 |
return t('Allows displaying image galleries with Flash animation');
|
| 10 |
}
|
| 11 |
}
|
| 12 |
|
| 13 |
function flash_gallery_perm() {
|
| 14 |
return array('administer flash gallery');
|
| 15 |
}
|
| 16 |
|
| 17 |
function flash_gallery_menu() {
|
| 18 |
drupal_add_css(drupal_get_path('module', 'flash_gallery') .'/flash_gallery.css');
|
| 19 |
if (module_exists('image_gallery')) {
|
| 20 |
drupal_add_css(drupal_get_path('module', 'image_gallery') .'/image_gallery.css');
|
| 21 |
}
|
| 22 |
|
| 23 |
$items = array();
|
| 24 |
$items['fgallery'] = array(
|
| 25 |
'page callback' => 'flash_gallery_render',
|
| 26 |
'access arguments' => array('access content'),
|
| 27 |
'type' => MENU_SUGGESTED_ITEM,
|
| 28 |
);
|
| 29 |
|
| 30 |
$items['fgallery_xml'] = array(
|
| 31 |
'page callback' => 'flash_gallery_xml',
|
| 32 |
'access arguments' => array('access content'),
|
| 33 |
'type' => MENU_CALLBACK,
|
| 34 |
);
|
| 35 |
|
| 36 |
$items['admin/content/fgallery'] = array(
|
| 37 |
'title' => t('Flash Galleries'),
|
| 38 |
'page callback' => 'drupal_get_form',
|
| 39 |
'page arguments' => array('flash_gallery_admin_flash_gallery_form'),
|
| 40 |
'access arguments' => array('administer flash gallery'),
|
| 41 |
);
|
| 42 |
return $items;
|
| 43 |
}
|
| 44 |
|
| 45 |
function flash_gallery_theme() {
|
| 46 |
return array(
|
| 47 |
'flash_gallery' => array(
|
| 48 |
'function' => 'flash_gallery',
|
| 49 |
'arguments' => array('galleries' => NULL, 'tid' => NULL,),
|
| 50 |
),
|
| 51 |
);
|
| 52 |
}
|
| 53 |
|
| 54 |
function flash_gallery_render($tid = 0) {
|
| 55 |
$tid = (int) $tid;
|
| 56 |
$output = '';
|
| 57 |
if (module_exists('image') && module_exists('image_gallery')) {
|
| 58 |
$galleries = taxonomy_get_tree(_image_gallery_get_vid(), $tid, -1, 1);
|
| 59 |
for ($i=0; $i < count($galleries); $i++) {
|
| 60 |
$galleries[$i]->count = taxonomy_term_count_nodes($galleries[$i]->tid, 'image');
|
| 61 |
$tree = taxonomy_get_tree(_image_gallery_get_vid(), $galleries[$i]->tid, -1);
|
| 62 |
$descendant_tids = array_merge(array($galleries[$i]->tid), array_map('_taxonomy_get_tid_from_term', $tree));
|
| 63 |
$last = db_fetch_object(db_query_range(db_rewrite_sql('SELECT n.nid FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN (%s) AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), implode(',', $descendant_tids), 0, 1));
|
| 64 |
$galleries[$i]->latest = node_load(array('nid' => $last->nid));
|
| 65 |
}
|
| 66 |
if ($tid) {
|
| 67 |
$gallery = taxonomy_get_term($tid);
|
| 68 |
$parents = taxonomy_get_parents($tid);
|
| 69 |
foreach ($parents as $parent) {
|
| 70 |
$breadcrumb[] = array('path' => 'fgallery/'. $parent->tid, 'title' => $parent->name);
|
| 71 |
}
|
| 72 |
$breadcrumb[] = array('path' => 'fgallery/', 'title' => t('Image galleries'));
|
| 73 |
$breadcrumb = array_reverse($breadcrumb);
|
| 74 |
drupal_set_title($gallery->name);
|
| 75 |
}
|
| 76 |
$breadcrumb[] = array('path' => $_GET['q']);
|
| 77 |
// menu_set_location($breadcrumb);
|
| 78 |
$output .= theme('flash_gallery', $galleries, $tid);
|
| 79 |
}
|
| 80 |
else {
|
| 81 |
drupal_set_message(t('Both image module and image_gallery module should be enabled to use flash galleries.'), 'error');
|
| 82 |
}
|
| 83 |
return $output;
|
| 84 |
}
|
| 85 |
|
| 86 |
function flash_gallery($galleries, $tid) {
|
| 87 |
$sizes = image_get_sizes();
|
| 88 |
$size = $sizes['thumbnail'];
|
| 89 |
$width = $size['width'];
|
| 90 |
$height = $size['height'];
|
| 91 |
|
| 92 |
$content = '';
|
| 93 |
if (count($galleries)) {
|
| 94 |
$content.= '<ul class="galleries">';
|
| 95 |
foreach ($galleries as $gallery) {
|
| 96 |
$content .= '<li class="clear-block">';
|
| 97 |
if ($gallery->count)
|
| 98 |
$content.= l(image_display($gallery->latest, 'thumbnail'), 'fgallery/'.$gallery->tid, array('html'=>TRUE));
|
| 99 |
$content.= "<h3>".l($gallery->name, 'fgallery/'.$gallery->tid) . "</h3>\n";
|
| 100 |
$content.= '<div class="description">'. check_markup($gallery->description) ."</div>\n";
|
| 101 |
$content.= '<p class="count">' . format_plural($gallery->count, 'There is 1 image in this gallery', 'There are @count images in this gallery') . "</p>\n";
|
| 102 |
if ($gallery->latest->changed) {
|
| 103 |
$content.= '<p class="last">'. t('Last updated: %date', array('%date' => format_date($gallery->latest->changed))) . "</p>\n";
|
| 104 |
}
|
| 105 |
$content.= "</li>\n";
|
| 106 |
}
|
| 107 |
$content.= "</ul>\n";
|
| 108 |
}
|
| 109 |
if ($tid && taxonomy_term_count_nodes($tid, 'image')) {
|
| 110 |
$location = base_path() . drupal_get_path('module', 'flash_gallery');
|
| 111 |
$content .= '<script type="text/javascript" src="'. $location .'/simpleviewer/swfobject.js"></script>';
|
| 112 |
$content .= t('<div id="flashcontent">Macromedia Flash is required. <a href="http://www.macromedia.com/go/getflashplayer/">Download Macromedia Flash.</a></div>');
|
| 113 |
$content .= '<script type="text/javascript">'."\n";
|
| 114 |
$op[] = $location .'/simpleviewer/viewer.swf';
|
| 115 |
$op[] = 'viewer';
|
| 116 |
$op[] = variable_get('flash_width', 700);
|
| 117 |
$op[] = variable_get('flash_height', 600);
|
| 118 |
// minimum Flash version required
|
| 119 |
$op[] = 7;
|
| 120 |
$op[] = '#'. variable_get('flash_background_color', '181818');
|
| 121 |
$content .= 'var fo = new SWFObject("'. implode('", "', $op) .'");'."\n";
|
| 122 |
if (variable_get('flash_transparent', 0)) {
|
| 123 |
$content .= 'fo.addParam("wmode", "transparent");'."\n";
|
| 124 |
}
|
| 125 |
$content .= 'fo.addVariable("preloaderColor", "0x'. variable_get('flash_loader_color', 'ff0000') .'");'."\n";
|
| 126 |
$content .= 'fo.addVariable("xmlDataPath", "'. url('fgallery_xml/'. $tid) .'");'."\n";
|
| 127 |
$content .= 'fo.write("flashcontent");'."\n";
|
| 128 |
$content .= '</script>';
|
| 129 |
}
|
| 130 |
if ($tid + count($galleries) == 0) {
|
| 131 |
$content.= '<p class="count">' . format_plural(0, 'There is 1 image in this gallery', 'There are @count images in this gallery') . "</p>\n";
|
| 132 |
}
|
| 133 |
return $content;
|
| 134 |
}
|
| 135 |
|
| 136 |
function flash_gallery_xml($tid = 0) {
|
| 137 |
$tid = (int) $tid;
|
| 138 |
$xml = '<?xml version="1.0" encoding="UTF-8"?>'."\n";
|
| 139 |
$xml = "<simpleviewerGallery ". flash_gallery_xml_options($tid) .">\n";
|
| 140 |
$result = db_query(db_rewrite_sql("SELECT n.nid FROM {term_node} t INNER JOIN {node} n ON t.nid=n.nid WHERE n.status=1 AND n.type='image' AND t.tid=%d ORDER BY n.sticky DESC, n.created DESC"), $tid);
|
| 141 |
while ($nid = db_fetch_object($result)) {
|
| 142 |
$node = node_load($nid->nid);
|
| 143 |
$images = $node->images;
|
| 144 |
if (flash_gallery_is_jpg(file_create_path($images['preview']))) {
|
| 145 |
$xml .= '<image><filename>';
|
| 146 |
$xml .= basename($images['preview']);
|
| 147 |
$xml .= '</filename><caption><![CDATA[';
|
| 148 |
if (variable_get('xml_display_title', 1)) {
|
| 149 |
$caption[] = $node->title;
|
| 150 |
}
|
| 151 |
if (variable_get('xml_show_link', 0)) {
|
| 152 |
$caption[] = '<u>'. l(t('download'), file_create_url($images['_original'])) .'</u>';
|
| 153 |
}
|
| 154 |
if ($caption) {
|
| 155 |
$xml .= implode(' :: ', $caption);
|
| 156 |
unset($caption);
|
| 157 |
}
|
| 158 |
$xml .= ']]></caption></image>'."\n";
|
| 159 |
|
| 160 |
}
|
| 161 |
}
|
| 162 |
$xml .= '</simpleviewerGallery>';
|
| 163 |
drupal_set_header('Content-type: text/xml');
|
| 164 |
print $xml;
|
| 165 |
exit;
|
| 166 |
}
|
| 167 |
|
| 168 |
function flash_gallery_xml_options($tid) {
|
| 169 |
$gallery = taxonomy_get_term($tid);
|
| 170 |
$op[] = 'maxImageWidth="'. variable_get('xml_max_width', 480) .'"';
|
| 171 |
$op[] = 'maxImageHeight="'. variable_get('xml_max_height', 480) .'"';
|
| 172 |
$op[] = 'textColor="0x'. variable_get('xml_text_color', 'ffffff') .'"';
|
| 173 |
$op[] = 'frameColor="0x'. variable_get('xml_frame_color', 'ffffff').'"';
|
| 174 |
$op[] = 'frameWidth="'. variable_get('xml_frame_width', 20) .'"';
|
| 175 |
$op[] = 'stagePadding="'. variable_get('xml_stage_padding', 40).'"';
|
| 176 |
$op[] = 'thumbnailColumns="'. variable_get('xml_thumb_columns', 4) .'"';
|
| 177 |
$op[] = 'thumbnailRows="'. variable_get('xml_thumb_rows', 1) .'"';
|
| 178 |
$op[] = 'navPosition="'. variable_get('xml_nav_position', 'top').'"';
|
| 179 |
$title = variable_get('xml_display_album', 1) ? $gallery->name : '';
|
| 180 |
$op[] = 'title="'. $title .'"';
|
| 181 |
$rc = variable_get('xml_right_click', 1) ? 'true' : 'false';
|
| 182 |
$op[] = 'enableRightClickOpen="'. $rc .'"';
|
| 183 |
//todo implement setting for background image
|
| 184 |
$op[] = 'backgroundImagePath=""';
|
| 185 |
$op[] = 'imagePath="'. flash_gallery_image_url() .'/"';
|
| 186 |
$op[] = 'thumbPath="'. flash_gallery_image_url() .'/flash/thumbs/"'; return implode(' ', $op);
|
| 187 |
}
|
| 188 |
|
| 189 |
function flash_gallery_admin_flash_gallery_form() {
|
| 190 |
|
| 191 |
flash_gallery_check_dirs();
|
| 192 |
$form['dimensions'] = array(
|
| 193 |
'#type' => 'fieldset',
|
| 194 |
'#title' => t('dimensions'),
|
| 195 |
'#collapsible' => TRUE,
|
| 196 |
'#collapsed' => TRUE,
|
| 197 |
'#description' => t('All dimensions should be given in pixels.'),
|
| 198 |
);
|
| 199 |
$form['dimensions']['flash_width'] = array(
|
| 200 |
'#type' => 'textfield',
|
| 201 |
'#default_value' => variable_get('flash_width', 700),
|
| 202 |
'#size' => 5,
|
| 203 |
'#maxlength' => 5,
|
| 204 |
'#title' => t('width of flash animation'),
|
| 205 |
'#required' => TRUE,
|
| 206 |
);
|
| 207 |
$form['dimensions']['flash_height'] = array(
|
| 208 |
'#type' => 'textfield',
|
| 209 |
'#default_value' => variable_get('flash_height', 600),
|
| 210 |
'#size' => 5,
|
| 211 |
'#maxlength' => 5,
|
| 212 |
'#title' => t('height of flash animation'),
|
| 213 |
'#required' => TRUE,
|
| 214 |
);
|
| 215 |
$form['dimensions']['xml_max_width'] = array(
|
| 216 |
'#type' => 'textfield',
|
| 217 |
'#default_value' => variable_get('xml_max_width', 480),
|
| 218 |
'#size' => 5,
|
| 219 |
'#maxlength' => 5,
|
| 220 |
'#title' => t('width of your largest image in pixels'),
|
| 221 |
'#required' => TRUE,
|
| 222 |
'#description' => t('Used to determine the best layout for your gallery.'),
|
| 223 |
);
|
| 224 |
$form['dimensions']['xml_max_height'] = array(
|
| 225 |
'#type' => 'textfield',
|
| 226 |
'#default_value' => variable_get('xml_max_height', 480),
|
| 227 |
'#size' => 5,
|
| 228 |
'#maxlength' => 5,
|
| 229 |
'#title' => t('height of your largest image in pixels'),
|
| 230 |
'#required' => TRUE,
|
| 231 |
'#description' => t('Used to determine the best layout for your gallery.'),
|
| 232 |
);
|
| 233 |
$form['dimensions']['xml_frame_width'] = array(
|
| 234 |
'#type' => 'textfield',
|
| 235 |
'#default_value' => variable_get('xml_frame_width', 20),
|
| 236 |
'#size' => 5,
|
| 237 |
'#maxlength' => 5,
|
| 238 |
'#title' => t('width of image frame in pixels'),
|
| 239 |
'#required' => TRUE,
|
| 240 |
);
|
| 241 |
$form['dimensions']['xml_stage_padding'] = array(
|
| 242 |
'#type' => 'textfield',
|
| 243 |
'#default_value' => variable_get('xml_stage_padding', 40),
|
| 244 |
'#size' => 5,
|
| 245 |
'#maxlength' => 5,
|
| 246 |
'#title' => t('stage padding'),
|
| 247 |
'#description' => t('Distance between image and thumbnails and around gallery edge in pixels.'),
|
| 248 |
'#required' => TRUE,
|
| 249 |
);
|
| 250 |
$form['colors'] = array(
|
| 251 |
'#type' => 'fieldset',
|
| 252 |
'#title' => t('colors'),
|
| 253 |
'#collapsible' => TRUE,
|
| 254 |
'#collapsed' => TRUE,
|
| 255 |
'#description' => t('All colors should be given as hexadecimal rgb-values.'),
|
| 256 |
);
|
| 257 |
$form['colors']['flash_background_color'] = array(
|
| 258 |
'#type' => 'textfield',
|
| 259 |
'#default_value' => variable_get('flash_background_color', '181818'),
|
| 260 |
'#size' => 6,
|
| 261 |
'#maxlength' => 6,
|
| 262 |
'#title' => t('background color'),
|
| 263 |
'#description' => t('Background color of flash animation.'),
|
| 264 |
'#required' => TRUE,
|
| 265 |
);
|
| 266 |
$form['colors']['flash_transparent'] = array(
|
| 267 |
'#type' => 'checkbox',
|
| 268 |
'#default_value' => variable_get('flash_transparent', 0),
|
| 269 |
'#title' => t('tranparency'),
|
| 270 |
'#description' => t('Checking this box will make your background transparent. This setting overrides the background color setting.'),
|
| 271 |
);
|
| 272 |
$form['colors']['flash_loader_color'] = array(
|
| 273 |
'#type' => 'textfield',
|
| 274 |
'#default_value' => variable_get('flash_loader_color', 'ff0000'),
|
| 275 |
'#size' => 6,
|
| 276 |
'#maxlength' => 6,
|
| 277 |
'#title' => t('flash loader color'),
|
| 278 |
'#description' => t('Color of part of flash animation that says "loading xml data", while loading your gallery.'),
|
| 279 |
'#required' => TRUE,
|
| 280 |
);
|
| 281 |
$form['colors']['xml_text_color'] = array(
|
| 282 |
'#type' => 'textfield',
|
| 283 |
'#default_value' => variable_get('xml_text_color', 'ffffff'),
|
| 284 |
'#size' => 6,
|
| 285 |
'#maxlength' => 6,
|
| 286 |
'#title' => t('text color'),
|
| 287 |
'#description' => t('Color of title and caption text.'),
|
| 288 |
'#required' => TRUE,
|
| 289 |
);
|
| 290 |
$form['colors']['xml_frame_color'] = array(
|
| 291 |
'#type' => 'textfield',
|
| 292 |
'#default_value' => variable_get('xml_frame_color', 'ffffff'),
|
| 293 |
'#size' => 6,
|
| 294 |
'#maxlength' => 6,
|
| 295 |
'#title' => t('frame color'),
|
| 296 |
'#description' => t('Color of image frame, navigation buttons (on top and hover buttons) and thumbnail frame.'),
|
| 297 |
'#required' => TRUE,
|
| 298 |
);
|
| 299 |
$form['navigation'] = array(
|
| 300 |
'#type' => 'fieldset',
|
| 301 |
'#title' => t('navigation'),
|
| 302 |
'#collapsible' => TRUE,
|
| 303 |
'#collapsed' => TRUE,
|
| 304 |
);
|
| 305 |
$options_1 = drupal_map_assoc(array(0, 1, 2, 3, 4, 5));
|
| 306 |
$options_2 = drupal_map_assoc(array('top', 'bottom', 'left', 'right'));
|
| 307 |
$form['navigation']['xml_nav_position'] = array(
|
| 308 |
'#type' => 'select',
|
| 309 |
'#options' => $options_2,
|
| 310 |
'#default_value' => variable_get('xml_nav_position', 'top'),
|
| 311 |
'#title' => t('navigation position'),
|
| 312 |
'#description' => t('Position of thumbnails relative to image.'),
|
| 313 |
);
|
| 314 |
$form['navigation']['xml_thumb_columns'] = array(
|
| 315 |
'#type' => 'select',
|
| 316 |
'#options' => $options_1,
|
| 317 |
'#default_value' => variable_get('xml_thumb_columns', 4),
|
| 318 |
'#title' => t('thumbnail columns'),
|
| 319 |
'#description' => t('Number of thumbnail columns. To disable thumbnails completely set this value to 0'),
|
| 320 |
);
|
| 321 |
$form['navigation']['xml_thumb_rows'] = array(
|
| 322 |
'#type' => 'select',
|
| 323 |
'#options' => $options_1,
|
| 324 |
'#default_value' => variable_get('xml_thumb_rows', 1),
|
| 325 |
'#title' => t('thumbnail rows'),
|
| 326 |
'#description' => t('Number of thumbnail rows. To disable thumbnails completely set this value to 0.'),
|
| 327 |
);
|
| 328 |
$form['miscellaneous'] = array(
|
| 329 |
'#type' => 'fieldset',
|
| 330 |
'#title' => t('miscellaneous'),
|
| 331 |
'#collapsible' => TRUE,
|
| 332 |
'#collapsed' => TRUE,
|
| 333 |
);
|
| 334 |
$form['miscellaneous']['xml_display_title'] = array(
|
| 335 |
'#type' => 'checkbox',
|
| 336 |
'#default_value' => variable_get('xml_display_title', 1),
|
| 337 |
'#title' => t('display title'),
|
| 338 |
'#description' => t('Whether to display the node title in the flash animation.'),
|
| 339 |
);
|
| 340 |
$form['miscellaneous']['xml_display_album'] = array(
|
| 341 |
'#type' => 'checkbox',
|
| 342 |
'#default_value' => variable_get('xml_display_album', 1),
|
| 343 |
'#title' => t('display album name'),
|
| 344 |
'#description' => t('Whether to display the album name in the flash animation.'),
|
| 345 |
);
|
| 346 |
$form['miscellaneous']['xml_show_link'] = array(
|
| 347 |
'#type' => 'checkbox',
|
| 348 |
'#default_value' => variable_get('xml_show_link', 0),
|
| 349 |
'#title' => t('display download link'),
|
| 350 |
'#description' => t('Apart from the node title, also display a clickable link to allow downloading the originally uploaded image.'),
|
| 351 |
);
|
| 352 |
$form['miscellaneous']['xml_rebuild_thumbs'] = array(
|
| 353 |
'#type' => 'checkbox',
|
| 354 |
'#default_value' => 0,
|
| 355 |
'#title' => t('build thumbnail library'),
|
| 356 |
'#description' => t('Normally, you should do this only once, after installing the module. This builds a library of thumbnails based on pre-existing images which reside inside pre-exising galleries. You do not have to repeat this later on: images that are created after installing this module are handled automatically. '),
|
| 357 |
);
|
| 358 |
$form['#validate'][] = 'flash_gallery_admin_validate';
|
| 359 |
return system_settings_form($form);
|
| 360 |
}
|
| 361 |
|
| 362 |
function flash_gallery_admin_validate($form, &$form_state) {
|
| 363 |
if ($form_state['values']['xml_rebuild_thumbs']) {
|
| 364 |
flash_gallery_rebuild_thumbs();
|
| 365 |
}
|
| 366 |
}
|
| 367 |
|
| 368 |
function flash_gallery_rebuild_thumbs() {
|
| 369 |
flash_gallery_check_dirs();
|
| 370 |
$tree = taxonomy_get_tree(_image_gallery_get_vid());
|
| 371 |
$tids = array_map('_taxonomy_get_tid_from_term', $tree);
|
| 372 |
$result = db_query(db_rewrite_sql("SELECT n.nid FROM {term_node} t INNER JOIN {node} n ON t.nid = n.nid WHERE n.status = 1 AND n.type='image' AND t.tid IN (%s)"), implode(',', $tids));
|
| 373 |
while ($nid = db_fetch_object($result)) {
|
| 374 |
$node = node_load($nid->nid);
|
| 375 |
$images = $node->images;
|
| 376 |
if ($images['preview'] && flash_gallery_is_jpg(file_create_path($images['preview']))) {
|
| 377 |
$preview_name = flash_gallery_image_path() .'/flash/thumbs/'. basename($images['preview']);
|
| 378 |
$thumb = file_create_path($images['thumbnail']);
|
| 379 |
if (!copy($thumb, $preview_name)) {
|
| 380 |
$error = TRUE;
|
| 381 |
}
|
| 382 |
}
|
| 383 |
}
|
| 384 |
if ($error) {
|
| 385 |
drupal_set_message(t('Not all thumbnails were successfully created'), 'error');
|
| 386 |
}
|
| 387 |
else {
|
| 388 |
drupal_set_message(t('Thumbnail library was successfully created'));
|
| 389 |
}
|
| 390 |
}
|
| 391 |
|
| 392 |
function flash_gallery_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
|
| 393 |
if ($node->type == 'image') {
|
| 394 |
$images = $node->images;
|
| 395 |
switch ($op) {
|
| 396 |
case 'insert':
|
| 397 |
case 'update':
|
| 398 |
if ($images['preview']) {
|
| 399 |
flash_gallery_check_dirs();
|
| 400 |
if (flash_gallery_is_jpg(file_create_path($images['preview']))) {
|
| 401 |
$preview_name = flash_gallery_image_path() .'/flash/thumbs/'. basename($images['preview']);
|
| 402 |
$thumb = file_create_path($images['thumbnail']);
|
| 403 |
copy($thumb, $preview_name);
|
| 404 |
}
|
| 405 |
}
|
| 406 |
break;
|
| 407 |
case 'delete':
|
| 408 |
if ($images['preview']) {
|
| 409 |
flash_gallery_check_dirs();
|
| 410 |
if (flash_gallery_is_jpg(file_create_path($images['preview']))) {
|
| 411 |
$preview_name = flash_gallery_image_path() .'/flash/thumbs/'. basename($images['preview']);
|
| 412 |
unlink($preview_name);
|
| 413 |
}
|
| 414 |
}
|
| 415 |
break;
|
| 416 |
}
|
| 417 |
}
|
| 418 |
}
|
| 419 |
|
| 420 |
function flash_gallery_is_jpg($path) {
|
| 421 |
$info = image_get_info($path);
|
| 422 |
if ($info['extension'] == 'jpg') {
|
| 423 |
return TRUE;
|
| 424 |
}
|
| 425 |
else {
|
| 426 |
return FALSE;
|
| 427 |
}
|
| 428 |
}
|
| 429 |
|
| 430 |
function flash_gallery_image_path() {
|
| 431 |
return rtrim(file_create_path(variable_get('image_default_path', 'images')), '/');
|
| 432 |
}
|
| 433 |
|
| 434 |
function flash_gallery_image_url() {
|
| 435 |
return rtrim(file_create_url(variable_get('image_default_path', 'images')), '/');
|
| 436 |
}
|
| 437 |
|
| 438 |
function flash_gallery_check_dirs() {
|
| 439 |
$path = flash_gallery_image_path() .'/flash';
|
| 440 |
$store_path = $path .'/thumbs';
|
| 441 |
if (!file_check_directory($path, FILE_CREATE_DIRECTORY)) {
|
| 442 |
return FALSE;
|
| 443 |
}
|
| 444 |
if (!file_check_directory($store_path, FILE_CREATE_DIRECTORY)) {
|
| 445 |
return FALSE;
|
| 446 |
}
|
| 447 |
return TRUE;
|
| 448 |
}
|