3217 Posts in 853 Topics by 812 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1237 Views |
-
Image Resize Question

17 March 2009 at 7:43am
I have read the tutorial for creating a function to resize an image but i cannot seem to get it to work correctly. Here is my scenario:
GalleryItemHolder.ss - this is the main Holder template that will contain the resized thumbnails
GalleryItemPage.ss - this is the detail page for each of the GalleryItems - the images that are resized on the Holder page are attached so the GalleryItemPage classI have added the following code to the GalleryItemPage.php
class GalleryItemPage extends Page {
static $db = array(
);
static $has_one = array(
'GalleryItemImage' => 'Image',
'GalleryItemThumb' => 'GalleryItemPage_Thumb150px'
);on what page do i put the following function class?
class GalleryItemPage_Thumb150px extends Image {
function generateThumb150px($gd) {
return $gd->resizeRatio(150,150);
}If I put in the GalleryItemPage.php file, it does not seem to be callable in the GalleryItemHolder.ss template - which is where i want the resized thumbnails to be generated.
-
Re: Image Resize Question

17 March 2009 at 4:40pm
I found the issue. I did not pick up on the fact that I needed to update the ClassName for all the existing images I had already uploaded in File table. Once I updated all the thumb images with the class name of GalleryItemPage_Thumb150px, the resize code worked. This is key for making this change after you've already uploaded images under the Image classname.
| 1237 Views | ||
|
Page:
1
|
Go to Top |

