WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Bakery Shop => Topic started by: snark on June 07, 2010, 09:23:27 AM

Title: Bakery with another fotogallery
Post by: snark on June 07, 2010, 09:23:27 AM
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: [Select]
// 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);


2.
add to your template between <head> and </head>:
Code: [Select]
<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>


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: [Select]
<div id="photos" class="galleryview">
[IMAGE]
[IMAGES]

  <ul class="filmstrip">
[THUMB]
[THUMBS]
  </ul>
</div>



[gelöscht durch Administrator]
Title: Re: Bakery with another fotogallery
Post by: maverik on June 07, 2010, 01:25:18 PM
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: [Select]
<?php
if (function_exists(&#39;register_frontend_modfiles&#39;)) {
        
register_frontend_modfiles(&#39;css&#39;);
        
register_frontend_modfiles(&#39;jquery&#39;);
        
register_frontend_modfiles(&#39;js&#39;);
?>

sorry english is not my language but i hope you understand it
Title: Re: Bakery with another fotogallery
Post by: snark on June 07, 2010, 01:47:18 PM
sorry, wrong copy paste shizzle ...

now it is corrected

the simplified code to include the jquery, yes offcourse, that is better ...
Title: Re: Bakery with another fotogallery
Post by: DGEC on June 08, 2010, 06:31:28 PM
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?
Title: Re: Bakery with another fotogallery
Post by: snark on June 08, 2010, 08:10:07 PM
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