Fluid - Bild mit TS konfigurieren (f:cObject) - was mache ich falsch? [Gelöst]

  • bberger bberger
    Padawan
    0 x
    33 Beiträge
    0 Hilfreiche Beiträge
    15. 10. 2012, 14:01

    Hallo liebe Community,

    brauche wieder einmal ein bisschen Rat:

    ich möchte ein Titelbild einer Melone im View anzeigen, das Ganze jedoch per TS konfigurierbar machen (sprich mit einem IMAGE-Objekt).

    Momentan habe ich in meinem View:

    1. <f:cObject typoscriptObjectPath="plugin.tx_melonenschlaraffenland.melonen.singleView.picture" data="{file: pictureTS.file}" />

    In meinem MelonenController:

    1. $pictureTS = array ('file' => $melone->getPicture());
    2.  
    3. $this->view->assign('pictureTS', $pictureTS);

    und im TypoScript:

    1. plugin.tx_melonenschlaraffenland {
    2. melonen {
    3. singleView {
    4. picture = IMAGE
    5. picture {
    6.  
    7. file.import.current = 1
    8. file.import.field = file
    9. file {
    10. height = 300c
    11. width = 200c
    12. }
    13. }
    14. }
    15. }
    16. }

    Aber irgendwie wird da kein Bild daraus.. wenn ich im TS jetzt aber file=uploads/tx_melonenschlaraffenland/einexistierendesbild.jpg setze funktioniert es - ergo mache ich definitiv was bei der Zuweisung falsch - jedoch was genau? So ganz habe ich das leider noch nicht durchschaut.. o.O

    LG
    Bernhard


  • 1
  • kitsunet kitsunet
    Flash Gordon
    0 x
    2559 Beiträge
    27 Hilfreiche Beiträge
    15. 10. 2012, 14:40

    Schau mal was in der Datenbank steht. Normalerweise nur der Dateiname, du musst den Pfad noch hinzufügen (wahlweise im PHP, Fluid oder Typoscript).

    config.baseURL = http://www.kitsunet.com/
    TYPO3 Flow und Neos Community Contact
    Release Manager TYPO3 Neos 1.1
    Ich habe Probleme mit den PMs hier, also schreibt mir bitte eine Mail oder über Twitter!

  • bberger bberger
    Padawan
    0 x
    33 Beiträge
    0 Hilfreiche Beiträge
    15. 10. 2012, 16:34

    Hab das ganze jetzt so gelöst, dass ich das Model um eine Eigenschaft "getPicturePath" erweitert habe, welche mir den kompletten Pfad liefert. Nicht die schönste Lösung, aber funktioniert.

    Achja, der Aufruf im [b]View [/b]sieht nun so aus:

    1. <f:cObject typoscriptObjectPath="plugin.tx_melonenschlaraffenland.melonen.singleView.picture" data="melone.picturePath" />

    [b]Controller:[/b]
    garnix mehr

    [b]Model:[/b]

    1. /**
    2. * Picture Path
    3. *
    4. * @var string
    5. */
    6. protected $picturePath;
    7.  
    8. /**
    9. * Returns the full picture path
    10. *
    11. * @return string $picturePath
    12. */
    13. public function getPicturePath() {
    14. return 'uploads/tx_melonenschlaraffenland/' . $this->picture;
    15. }

    und im TS (das import.field rausgenommen):

    1. plugin.tx_melonenschlaraffenland {
    2. melonen {
    3. singleView {
    4. picture = IMAGE
    5. picture {
    6. file.import =
    7. file.import.current = 1
    8. file {
    9. height = 300c
    10. width = 200c
    11. }
    12. }
    13. }
    14. }
    15. }

  • 1