Results 1 to 2 of 2

Thread: Image Text Content Element

  1. #1
    New user
    Join Date
    07-30-11.
    Posts
    3

    Default Image Text Content Element

    I am working on a Content Element which displays Text over Image.
    It works fine except one feature. The Image is not resized.

    Here is my Code. Probalbly I missed the compile function. How can I make it work?

    Code:
    $GLOBALS['TL_DCA']['tl_content']['palettes']['imagetextfusion'] = '{type_legend},type;{Ueberschrift & Text}, headline, text;{image_legend},singleSRC, size;';
    
    
    /**
     * Fields
     */
    $GLOBALS['TL_DCA']['tl_content']['fields']['headline'] = array
    (
        'label'                => &$GLOBALS['TL_LANG']['tl_content']['headline'],
        'inputType'        => 'text',
       'eval'       => array('mandatory'=>false, 'maxlength'=>255)
    );
    
    $GLOBALS['TL_DCA']['tl_content']['fields']['text'] = array
    (
        'label'            => &$GLOBALS['TL_LANG']['tl_content']['text'],
        'inputType' => 'textarea',
        'eval'      => array('mandatory'=>false, 'maxlength'=>455)
    );
    
    
    
    
    
    
    class ContentImageTextFusion extends ContentElement
    {
    
        /**
         * Template
         * @var string
         */
        protected $strTemplate = 'ce_imagetextfusion';
    
    
        /**
         * Generate module
         */
    
    
    
     protected function compile() {
             $this->Template = new FrontendTemplate("ce_imagetextfusion");
            $this->Template->id = $this->id;
            $this->Template->headline = $this->headline;
            $this->Template->text = $this->text;
            $this->Template->singleSRC = $this->singleSRC;
           } 
     }

  2. #2

    Default Re: Image Text Content Element

    Hi, you didn't use a resize function for you image.
    The only thing you have done is making a field to select image and provide size of image.

    You could use this in the template to provide width and height, or you use the built-in function from Contao to resize your image. You will need to search for the function as I don't know it by hart.


    Rgds

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •