Hello I have a problem I could not do a resize a photo already investigated but failed to
this is my code
Galeria.php
--------------------------------------------
class Galeria extends DataObject {
static $db = array ('Titulo' => 'Varchar', 'Desc' => 'HTMLText' );
static $has_one = array ('GaleriaPage' => 'GaleriaPage', 'Image' => 'Image' );
public function getCMSFields_forPopup() {
$fields = new FieldSet ( new TextField ( 'Titulo' ), new HtmlEditorField ( 'Desc' ), new ImageField ( 'Image' ) );
return $fields;
}
}
--------------------------------------------
Galeria.php
--------------------------------------------
class GaleriaPage extends Page {
static $has_many = array(
'Galerias' => 'Galeria',
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Galeria',
new DataObjectManager(
$this,
'Galerias',
'Galeria',
array('Imagen' => 'Imagen', 'Titulo' => 'Titulo','Desc' => 'Descripcion'),
'getCMSFields_forPopup'
));
return $fields;
}
}
class GaleriaPage_Controller extends Page_Controller {
function init() {
parent::init();
Requirements::css('jsparty/Slideshow2/css/slideshow.css');
Requirements::javascript('themes/mtac/js/mootools.js');
Requirements::javascript('themes/mtac/js/slideshow.js');
Requirements::javascript('themes/mtac/js/slideshow.kenburns.js');
}
function Galery() {
$reviewContent = DataObject::get("Galeria","GaleriaPageID =" . $this->ID);
// Debug::show($reviewContent);
return $reviewContent;
}
function ImgResize($gd) {
return $gd->resize(50,50)->URL();
}
}
--------------------------------------------
GaleriaPage.ss
--------------------------------------------
....
<script>
var data = {
<% control Galery %>
'$Image.URL': {
caption: '$Titulo',
thumbnail: '$Image.ImgResize'
<% if Last %> } <% else %> }, <% end_if %>
<% end_control %>
};
</script>
....
--------------------------------------------
thanks in advance for helping