diff -Naupr gallerix/gallerix.module sites/all/modules/contrib/gallerix/gallerix.module --- gallerix/gallerix.module 2008-07-27 18:48:28.000000000 -0700 +++ sites/all/modules/contrib/gallerix/gallerix.module 2009-07-30 17:14:10.000000000 -0700 @@ -337,7 +337,7 @@ function _gallerix_load_frame($picture) list($width, $height) = @getimagesize($local->frame); return array( - 'framePath' => $picture->frame, + 'framePath' => file_create_url(preg_replace('#^/#', '', $picture->frame)), 'frameWidth' => $width, 'frameHeight' => $height, ); @@ -358,7 +358,7 @@ function _gallerix_load_thumbnails($pict $thumbnails = array(); $thumbnails['gallerix-thumbnail-link-' . $current] = array( - 'path' => $picture->thumbnail, + 'path' => file_create_url(preg_replace('#^/#', '', $picture->thumbnail)), 'link' => gallerix_url($picture), 'caption' => $picture->caption, 'current' => TRUE, @@ -379,7 +379,7 @@ function _gallerix_load_thumbnails($pict $previous = gallerix_load_picture($previous_pid, $picture->local); $thumbnails['gallerix-thumbnail-link-' . $previous_count] = array( - 'path' => $previous->thumbnail, + 'path' => file_create_url(preg_replace('#^/#', '', $previous->thumbnail)), 'link' => gallerix_url($previous->pid), 'caption' => $previous->caption, 'key' => gallerix_url($previous->pid, 'fragment'), @@ -398,7 +398,7 @@ function _gallerix_load_thumbnails($pict $next = gallerix_load_picture($next_pid, $picture->local); $thumbnails['gallerix-thumbnail-link-' . $x] = array( - 'path' => $next->thumbnail, + 'path' => file_create_url(preg_replace('#^/#', '', $next->thumbnail)), 'link' => gallerix_url($next->pid), 'caption' => $next->caption, 'key' => gallerix_url($next->pid, 'fragment'), @@ -549,7 +549,7 @@ function theme_gallerix_user_pictures_bl $picture = gallerix_load_picture($pid->pid); - $thumbnail = theme('image', $picture->thumbnail, '', $picture->caption, array('class' => 'gallerix-external-thumbnail' . $translucent)); + $thumbnail = theme('image', file_create_url(preg_replace('#^/#', '', $picture->thumbnail)), '', $picture->caption, array('class' => 'gallerix-external-thumbnail' . $translucent), FALSE); $link = 'node/' . $picture->nid; $fragment = gallerix_url($picture, 'fragment'); @@ -591,7 +591,7 @@ function theme_gallerix_latest_pictures_ $picture = gallerix_load_picture($pid->pid); - $thumbnail = theme('image', $picture->thumbnail, '', $picture->caption, array('class' => 'gallerix-external-thumbnail' . $translucent)); + $thumbnail = theme('image', file_create_url(preg_replace('#^/#', '', $picture->thumbnail)), '', $picture->caption, array('class' => 'gallerix-external-thumbnail' . $translucent), FALSE); $link = 'node/' . $picture->nid; $fragment = gallerix_url($picture, 'fragment'); @@ -648,7 +648,7 @@ function theme_gallerix_random_pictures_ $picture = gallerix_load_picture($pid); - $thumbnail = theme('image', $picture->thumbnail, '', $picture->caption, array('class' => 'gallerix-external-thumbnail' . $translucent)); + $thumbnail = theme('image', file_create_url(preg_replace('#^/#', '', $picture->thumbnail)), '', $picture->caption, array('class' => 'gallerix-external-thumbnail' . $translucent), FALSE); $link = 'node/' . $picture->nid; $fragment = gallerix_url($picture, 'fragment'); @@ -1198,7 +1198,7 @@ function theme_gallerix_frame($node) { $output = ''; $output .= '
' . "\n" ; $output .= '
' . "\n" ; - $output .= theme('image', $source,'', $picture->caption, array('id' => 'gallerix-frame')); + $output .= theme('image', file_create_url(preg_replace('#^/#', '', $source)),'', $picture->caption, array('id' => 'gallerix-frame'), FALSE); $output .= '
' . "\n" ; $output .= '
' . "\n" ; @@ -1258,7 +1258,7 @@ function theme_gallerix_grid($node) { while ($pid = db_fetch_object($pictures)) { $picture = gallerix_load_picture($pid->pid); - $thumbnail = theme('image', $picture->thumbnail, '', $picture->caption, array('class' => 'gallerix-thumbnail' . $translucent)); + $thumbnail = theme('image', file_create_url(preg_replace('#^/#', '', $picture->thumbnail)), '', $picture->caption, array('class' => 'gallerix-thumbnail' . $translucent), FALSE); $output .= l($thumbnail, 'node/' . $picture->nid, array('class' => 'gallerix-grid-link ' . 'gallerix-picture-link'), 'picture=' . $picture->pid, NULL, FALSE, TRUE); } @@ -1282,7 +1282,7 @@ function theme_gallerix_album_teaser($no $default = gallerix_load_picture($node->gallerix['default']); $output = '
'; - $teaser_image .= theme('image', $default->frame,'', $default->caption, array('class' => 'gallerix-teaser'), TRUE); + $teaser_image .= theme('image', file_create_url(preg_replace('#^/#', '', $default->frame)),'', $default->caption, array('class' => 'gallerix-teaser'), FALSE); $output .= l($teaser_image, 'node/' . $node->nid, array(), NULL, NULL, FALSE, TRUE); @@ -1659,7 +1659,7 @@ function gallerix_load_picture($pid, $lo $sizes = gallerix_sizes(); foreach ($sizes as $size => $properties) { - $picture->$size = $paths['album'] . '/' . $size . '/' . $picture->name; + $picture->$size = $paths['album'] . '/' . $size . '/' . $picture->name; } $picture->paths = $paths['paths']; @@ -1934,3 +1934,31 @@ function gallerix_delete_directory($dire return TRUE; } +function gallerix_file_download($filepath) { + $sizes = gallerix_sizes(); + foreach ($sizes as $key => $val) { + $filepath = preg_replace('#/'.preg_quote($key).'/#', '/original/', $filepath); + } + + $filepath = file_create_path($filepath); + $result = db_queryd("SELECT * FROM {gallerix_pictures} WHERE path = '%s'", $filepath); + if ($file = db_fetch_object($result)) { + if (user_access('view uploaded files')) { + $node = node_load($file->nid); + if (node_access('view', $node)) { + $info = image_get_info($filepath); + $type = $info['mime_type']; + return array( + 'Content-Length: '. filesize($filepath), + 'Content-Type: ' . $type, + ); + } + else { + return -1; + } + } + else { + return -1; + } + } +} \ No newline at end of file diff -Naupr gallerix/management.inc sites/all/modules/contrib/gallerix/management.inc --- gallerix/management.inc 2008-07-27 18:48:28.000000000 -0700 +++ sites/all/modules/contrib/gallerix/management.inc 2009-07-30 13:51:42.000000000 -0700 @@ -794,7 +794,7 @@ function theme_gallerix_manage_pictures_ 'style' => 'margin: 2px; cursor: pointer;' ); - $thumbnail = theme('image', $picture->thumbnail, $alt = '', $basename, $thumbnail_attributes, FALSE); + $thumbnail = theme('image', file_create_url(preg_replace('#^/#', '', $picture->thumbnail)), $alt = '', $basename, $thumbnail_attributes, FALSE); unset($form['gallerix_album']['checkboxes'][$key]['#title']); unset($form['gallerix_album']['captions'][$key]['#title']); diff -Naupr gallerix/views.inc sites/all/modules/contrib/gallerix/views.inc --- gallerix/views.inc 2008-07-19 16:36:40.000000000 -0700 +++ sites/all/modules/contrib/gallerix/views.inc 2009-07-30 14:37:47.000000000 -0700 @@ -132,17 +132,51 @@ function gallerix_views_handler_album($f * */ function theme_views_view_gallerix_grid($view, $type, $nodes, $level = NULL, $args = NULL) { + $num_nodes = count($nodes); + $output = ''; - $output .= '
'; - - gallerix_load_style(); - gallerix_load_js(); - foreach($nodes as $node) { - $output .= theme('gallerix_albums_grid', $node); + if ($type == 'page') { + drupal_set_title(filter_xss_admin(views_get_title($view, 'page'))); + views_set_breadcrumb($view); } + + if ($num_nodes) { + $output .= views_get_textarea($view, $type, 'header'); + } + + if ($type != 'block' && $view->exposed_filter) { + $output .= views_theme('views_display_filters', $view); + } + + $plugins = _views_get_style_plugins(); + $view_type = ($type == 'block') ? $view->block_type : $view->page_type; + if ($num_nodes || $plugins[$view_type]['even_empty']) { - $output .= '
'; + $output .= '
'; + gallerix_load_style(); + gallerix_load_js(); + + foreach($nodes as $node) { + $output .= theme('gallerix_albums_grid', $node); + } + + $output .= '
'; + + $output .= views_get_textarea($view, $type, 'footer'); + + if ($type == 'block' && $view->block_more && $num_nodes >= $view->nodes_per_block) { + $output .= theme('views_more', $view->real_url); + } + } + else { + $output .= views_get_textarea($view, $type, 'empty'); + } + + if ($view->use_pager) { + $output .= theme('pager', '', $view->pager_limit, $view->use_pager - 1); + } + return $output; } @@ -160,7 +194,7 @@ function theme_gallerix_albums_grid($nod if ($node->gallerix['default']) { $default = gallerix_load_picture($node->gallerix['default']); - $thumbnail = theme('image', $default->$size, '', $node->title, array('class' => 'gallerix-external-thumbnail' . $translucent)); + $thumbnail = theme('image', file_create_url(preg_replace('#^/#', '', $default->$size)), '', $node->title, array('class' => 'gallerix-external-thumbnail' . $translucent), FALSE); } @@ -170,4 +204,3 @@ function theme_gallerix_albums_grid($nod return $output; } -