WebsiteBaker Support (2.8.x) > Bakery Shop
Bakery with another fotogallery
(1/1)
snark:
for a bakery with http://spaceforaname.com/gallery-light.html as a image slideshow
1.
change the file view_item.php
replace line 130 to app. 188 for
--- Code: ---// Initialize or reset thumb(s) and image(s) befor laoding next item
$thumb_arr = array();
$image_arr = array();
$thumb = "";
$image = "";
$img_hoogte = 400;
// Prepare thumb and image directory pathes and urls
$thumb_dir = WB_PATH.MEDIA_DIRECTORY.'/showroom/thumbs/item'.ITEM_ID.'/';
$img_dir = WB_PATH.MEDIA_DIRECTORY.'/showroom/images/item'.ITEM_ID.'/';
$thumb_url = WB_URL.MEDIA_DIRECTORY.'/showroom/thumbs/item'.ITEM_ID.'/';
$img_url = WB_URL.MEDIA_DIRECTORY.'/showroom/images/item'.ITEM_ID.'/';
// Check if the thumb and image directories exist
if (is_dir($thumb_dir) && is_dir($img_dir)) {
// Open the image directory then loop through its contents
$dir = dir($img_dir);
while (false !== $image_file = $dir->read()) {
// Skip index file and pointers
if (eregi(".php", $image_file) || substr($image_file, 0, 1) == ".") {
continue;
}
// Thumbs use .jpg extension only
$thumb_file = str_replace (".png", ".jpg", $image_file);
// Convert filename to lightbox2 title
$img_title = str_replace(array(".png", ".jpg"), "", $image_file);
$img_title = str_replace("_", " ", $img_title);
// Make array of all item thumbs and images
if (file_exists($thumb_dir.$thumb_file) && file_exists($img_dir.$image_file)) {
// If needed add lightbox2 link to the thumb/image...
if ($setting_lightbox2 == "detail" || $setting_lightbox2 == "all") {
$prepend = "<a href='".$img_url.$image_file."' rel='lightbox[image_".ITEM_ID."]' title='".$img_title."'><img src='";
$thumb_append = "' alt='".$img_title."' title='".$img_title."' /></a>";
$img_append = "' alt='".$img_title."' title='".$img_title."' /></a>";
// ...else add thumb/image only
} else {
$prepend = "<li><img src='";
$img_prepend = "<div class=\"panel\"><img src='";
$thumb_append = "' alt='".$img_title."' title='".$img_title."' /></li>";
$img_append = "' alt='".$img_title."' title='".$img_title."' height='".$img_hoogte."'/></div>";
}
// Check if a main thumb/image is set
if ($image_file == $item['main_image']) {
$thumb = $prepend.$thumb_url.$thumb_file.$thumb_append;
$image = $img_prepend.$img_url.$image_file.$img_append;
continue;
}
// Make array
$thumb_arr[] = $prepend.$thumb_url.$thumb_file.$thumb_append;
$image_arr[] = $img_prepend.$img_url.$image_file.$img_append;
}
}
}
// Make strings for use in the item templates
$thumbs = implode("\n", $thumb_arr);
$images = implode("\n", $image_arr);
--- End code ---
2.
add to your template between <head> and </head>:
--- Code: ---<script type="text/javascript" src="<?php echo TEMPLATE_DIR; ?>/scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="<?php echo TEMPLATE_DIR; ?>/scripts/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="<?php echo TEMPLATE_DIR; ?>/scripts/jquery.galleryview-1.1.js"></script>
<script type="text/javascript" src="<?php echo TEMPLATE_DIR; ?>/scripts/jquery.timers-1.1.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#photos').galleryView({
panel_width: 600,
panel_height: 450,
frame_width: 100,
frame_height: 100
});
});
</script>
--- End code ---
3. include in your template files the attached zip with the js scripts
4. add to the add.php or directly into the page settings in the admin:
--- Code: ---<div id="photos" class="galleryview">
[IMAGE]
[IMAGES]
<ul class="filmstrip">
[THUMB]
[THUMBS]
</ul>
</div>
--- End code ---
[gelöscht durch Administrator]
maverik:
This is not quite right. In your first step, you load the scripts from the view_tem.php. In your second step, you load the scripts once in the head of the template.
jQuery 1.3.2 is no longer current.
jQuery in the latest version you can use with register_frontend_m odfiles in head section.
--- Code: ---<?php
if (function_exists('register_frontend_modfiles')) {
register_frontend_modfiles('css');
register_frontend_modfiles('jquery');
register_frontend_modfiles('js');
} ?>
--- End code ---
sorry english is not my language but i hope you understand it
snark:
sorry, wrong copy paste shizzle ...
now it is corrected
the simplified code to include the jquery, yes offcourse, that is better ...
DGEC:
Probably worth noting that this photo gallery is the plugin called GalleryView, and the homepage is http://spaceforaname.com/galleryview
However, the latest version & release information is only on http://plugins.jquery.com/project/galleryview
Thanks snoork, this looks like a nice option. Any thought of packaging it into a module or another package?
snark:
you can reather easily use bakery and comment out all shop options so that you have an imagegallery with a textfield
on the other hand you might want the option like brax highslide gallery to point out a folder to automatically generate the image gallery.
I guess it can be done, I will try to find the time
Navigation
[0] Message Index
Go to full version