Ergebnis 1 bis 6 von 6

Thema: Bildgröße im Quelltext

  1. #1
    Contao-Nutzer
    Registriert seit
    09.03.2014.
    Beiträge
    62

    Standard Bildgröße im Quelltext

    Ich habe eine ähnliche config zusätzlich noch mit alt und title:

    PHP-Code:
            'image' => array(
                
    'label' => array('Veranstaltungsbild''Wählen Sie ein Bild für die Veranstaltung aus.'),
                
    'inputType' => 'fileTree',
                
    'eval' => array(
                    
    'mandatory' => false,
                    
    'fieldType' => 'radio',
                    
    'extensions' => 'jpg,jpeg,png,gif,svg,webp',
                    
    'filesOnly' => true,
                ),
                
    'tl_class' => 'veranstaltung-image',
            ),
            
    'image_alt' => array(
                
    'label' => array('Bild-Alt-Text''Geben Sie den Alt-Text für das Bild ein.'),
                
    'inputType' => 'text',
                
    'eval' => array('mandatory' => false'tl_class' => 'w50'),
                
    'tl_class' => 'veranstaltung-image-alt',
                
    'dependsOn' => 'image',
            ),
            
    'image_title' => array(
                
    'label' => array('Bild-Titel''Geben Sie den Titel für das Bild ein.'),
                
    'inputType' => 'text',
                
    'eval' => array('mandatory' => false'tl_class' => 'w50'),
                
    'tl_class' => 'veranstaltung-image-title',
                
    'dependsOn' => 'image',
            ),
            
    'size' => array(
                
    'label' => array(
                    
    'en' => array('Image width and height'''),
                    
    'de' => array('Bildbreite und Bildhöhe'''),
                ),
                
    'inputType' => 'imageSize',
    //            'options' => Contao\System::getContainer()->get('contao.image.sizes')->getAllOptions(),
                
    'options' => \Contao\System::getContainer()->get('contao.image.sizes')->getAllOptions(),
                
    'reference' => &$GLOBALS['TL_LANG']['MSC'],
                
    'eval' => array(
                    
    'rgxp' => 'digit',
                    
    'includeBlankOption' => true,
            
    'tl_class' => 'w50',
                ),
            ), 
    Bei mir hapert es am html5 template. Wie kann ich da die imageSize mit ausgeben?

    PHP-Code:
    <!-- rsce_veranstaltung.html5 -->
    <?php
    use Contao\FilesModel;
    ?>

    <div class="veranstaltung col-sm-6 p-b-3">
        <?php if ($this->datum_und_wochentag) { ?>
            <div class="veranstaltung-datum">
                <?php echo $this->datum_und_wochentag?>
            </div>
        <?php ?>

        <?php if ($this->titel) { ?>
            <div class="veranstaltung-titel">
                <h4><?php echo $this->titel?></h4>
            </div>
        <?php ?>

    <?php  if ($this->image) { ?>
            <div class="veranstaltung-image-container">
                <figure class="event-image">
                    <img src="<?php echo \Contao\FilesModel::findByPk($this->image)->path?>
                         alt="<?php echo $this->image_alt?>
                         title="<?php echo $this->image_title?>
                         class="veranstaltung-image" />
                </figure>
            </div>
        <?php ?> 

        <div class="veranstaltung-content">
            <?php if ($this->beschreibung) { ?>
                <div class="veranstaltung-beschreibung">
                    <?php echo $this->beschreibung?>
                </div>
            <?php ?>

            <?php if ($this->preis) { ?>
                <div class="veranstaltung-preis">
                    <strong>Preis:</strong> <?php echo $this->preis?>
                </div>
            <?php ?>

            <?php if ($this->hinweis) { ?>
                <div class="veranstaltung-hinweis">
                    <?php echo $this->hinweis?>
                </div>
            <?php ?>
        </div>
    </div>
    Ich hab schon einiges ausprobiert und im Forum gesucht, komme aber leider nicht zur Lösung.

  2. #2
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    37.191
    Partner-ID
    10107

    Standard

    Dein Post klingt erst mal nicht so, als hätte das etwas mit diesem Thread zu tun. Welches Problem genau hast du?
    » sponsor me via GitHub or Revolut

  3. #3
    Contao-Nutzer
    Registriert seit
    09.03.2014.
    Beiträge
    62

    Standard

    Hi Spooky,

    die Bildgröße erscheint nicht im Quelltext (also keine height und keine width).

  4. #4
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    37.191
    Partner-ID
    10107

    Standard

    Moderation: Posts in einen eigenen Thread verschoben.
    » sponsor me via GitHub or Revolut

  5. #5
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    37.191
    Partner-ID
    10107

    Standard

    Zitat Zitat von ConZens Beitrag anzeigen
    die Bildgröße erscheint nicht im Quelltext (also keine height und keine width).
    Ja, du lässt das ja aktuell auch gar nicht ausgeben. Ich würde dir empfehlen es lieber so zu machen:
    PHP-Code:
    <?php if ($this->image): ?>
        <div class="veranstaltung-image-container">
            <?=
                $this
    ->figure(
                    
    $this->image,
                    
    $this->size,
                    [
                        
    'options' => [
                            
    'attr' => [
                                
    'class' => 'event-image',
                            ],
                        ],
                        
    'metadata' => [
                            
    'alt' => $this->image_alt,
                            
    'title' => $this->image_title,
                        ],
                    ],
                )
            
    ?>
        </div>
    <?php endif; ?>
    » sponsor me via GitHub or Revolut

  6. #6
    Contao-Nutzer
    Registriert seit
    09.03.2014.
    Beiträge
    62

    Standard

    Ja, super, so geht's.

    Vielen Dank Spooky.

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •