5099 Posts in 1519 Topics by 1116 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 383 Views |
-
Size of ImageField thumbnail in Backend

16 March 2012 at 5:46am
Hi everybody.
The goal:
My client want a bigger thumbnail of the image attached to a dataobject.What I've done so far:
The dataobjectitems are houses with a bunch of values. The image is bind with static $has_one = array('Image' => 'Image' );
The imagefield is generated in getCMSFields with $fields->addFieldToTab("Root.Main", new ImageField('Image', 'Bild des Objektes', Null, Null, Null, 'images-immodatabase'));My question is:
How to alter the size of the allready attached image. Is there a simple config line? Or do i have to edit the core (Imagefield)?
Thanks for your help.Pipifix.
-
Re: Size of ImageField thumbnail in Backend

20 March 2012 at 11:08am Last edited: 20 March 2012 11:08am
Pipifix,
Not sure if this answers your question, but in your template you can call Graphic Draw functions via SilverStripe.
In your template:
$Image.SetWidth(250)
See: http://api.silverstripe.org/2.4/sapphire/filesystem/Image.html for a list of available methods on Image objects.
Cheers,
Josh -
Re: Size of ImageField thumbnail in Backend

20 March 2012 at 11:10am
Let me know if you were wanting to increase the image size in the back end (CMS), and not on the front end (template) of your site.
-
Re: Size of ImageField thumbnail in Backend

30 March 2012 at 8:39am
Thanks novaweb.
I meant the thumbnail preview in the ModelAdmin (=Backend).
Pipifix
-
Re: Size of ImageField thumbnail in Backend

12 April 2012 at 2:55am Last edited: 12 April 2012 2:55am
I've done custom thumbnails in modeladmin table.
//first add you're custom thumbnail field to the Summary Field
static $summary_fields = array('Thumb');//then create a a custom getter for it
public function getThumb(){
$image = DataObject::get_by_id("File", $this->ImageID);
if ($image){
return $image->setWidth(50);
} else {
return "No Image Available";
}
}
I'm assuming that your image is held under ImageID, and for the return function you can use any of the standard image functions.Now this won't change the size of the thumbnail in the CMS ImageField, unfortunately the current ImageFIeld doesn't allow you to customize the thumbnail size
I think I also saw a tutorial for this on SSBits.com, not sure if their implementation is better. I had a solution when by the time I saw it there
Cheers
| 383 Views | ||
|
Page:
1
|
Go to Top |



