10448 Posts in 2223 Topics by 1719 members
| Go to End | Next > | |
| Author | Topic: | 67628 Views |
-
Re: Image Gallery Extension: Testers Needed

7 April 2009 at 6:34am
Once again, thanks for all your help UncleCheese. I am building a web site for a client who is a professional photographer. As such he is pretty picky about cropping and sizing his images. He creates his own thumbnails and I would like to be able to use them instead of the SS auto generated ones. Is there a way for me to extend the image_gallery to allow me to pick or upload both the large image and the thumbnail?
I understand that this may be a large departure from the way this modules is intended to work. However I do think that many users of this gallery would like an option to have greater control over quality of presentation.
If you just point me in the right direction I could probably make the modifications my self.
-
Re: Image Gallery Extension: Testers Needed

7 April 2009 at 6:44am
If I were you, I would first extend the ImageGalleryPage class, and have it relate to another extended ImageGalleryItem class. Your ImageGalleryItem subclass could have a Thumbnail field.
class MyGallery extends ImageGalleryPage
{
protected $itemClass = "MyImageGalleryItem";static $has_many = array (
'MyImageGalleryItems' => 'MyImageGalleryItem'
);
}class MyImageGalleryItem extends ImageGalleryItem
{
static $has_one = array ('Thumbnail' => 'Image');public function getCMSFields_forPopup()
{
$f = parent::getCMSFields_forPopup();
$f->push(new ImageField('Thumbnail'));
return $f;
}
}I'll make an update to the core to use the dynamic $itemClass property in the GalleryItems() control.
Then you just need to update your template to use the new thumbnail image.
-
Re: Image Gallery Extension: Testers Needed

7 April 2009 at 7:23am
Good evening UncleCheese,
I'm using SS 2.3.1 with your current SVN trunk and cannot select an album image from a sub subdirectory of the file store. The sub subdirectory icon has no "+" and is not expandable. Would you please fix that bug?
Thanks in advance!
P.S. Good job anyway!
-
Re: Image Gallery Extension: Testers Needed

7 April 2009 at 7:28am
Thanks, I think I understand how that will work. I can then do something similar to force the image_gallery to also load the uploaded image instead of the resampled one. I find that if I put a size in for the original it will make smaller images larger and so they won't look very good. I don't wan't to have to always upload images that are the size that is defined as the original size in the CMS.
I will like having a gallery that has my sized and cropped thumbnails and full size images.
Thanks again for your help. I am learning a lot about SS and OOP at the same time.
-
Re: Image Gallery Extension: Testers Needed

7 April 2009 at 7:29am
Sounds like a bug with the TreeDropdownField to me. Have you checked open.silverstripe.com?
-
Re: Image Gallery Extension: Testers Needed

7 April 2009 at 9:05am
Regarding the custom Thumbnail upload. I have implemented a solution based on your recommendation and now my gallery images have an extra image upload area which is good. When I upload a thumbnail image I can see the line get added to the database table where it should however I am missing something in my code as the popup does not display the thumbnail as the normal upload area does. Also I am not sure how to tell my template to get the uploaded thumbnail. I can see that in the template it uses $ThumbnailURL to get it but what would I use to get the new one?
Also is it possible to get the $ViewLink to display the path to the original image instead of the resized one?
-
Re: Image Gallery Extension: Testers Needed

7 April 2009 at 9:16am
You're going to need to modify the template a bit to get it to work. Create MyImageGalleryPage.ss, copy the template over from the image_gallery module, and customize it. To get the thumbnail all you should have to do in your GalleryItems control is $Thumbnail - assuming that's the name of the field on your ImageGalleryItem subclass.
As far as all the UI stuff, that's entirely up to you. But use the OO design pattern to overload the methods in ImageGalleryPage to customize the variables you need. I personally wouldn't bother with ViewLink if you're doing a custom template anyway. That stuff is just in there to support the UI plugins.
-
Re: Image Gallery Extension: Testers Needed

8 April 2009 at 5:36am Last edited: 8 April 2009 5:36am
Hello again,
I've found out that there's no problem with the TreeDropdownField. After importing images from an existing folder to a new album, all images from the original folder moved to a folder named "image-gallery/<album name>". The original folder still exists, but contains only a sub folder named "_resampled". The destination folder now contains the images and also a sub folder "_resampled".
Is this a bug or the right behaviour?
| 67628 Views | ||
| Go to Top | Next > |

