nikosch / ProcessWireImageLink

3 stars 1 forks source link

Populate PageImage object with data from hooks #3

Closed gerritvanaaken closed 8 years ago

gerritvanaaken commented 8 years ago

I use the excellent ImageExtra module which enriches the PageImage object with some metadata, via proper PW hooks.

ProcessWireImageLink can returns PageImage objects, but the metadata from ImageExtra is missing, although the hooks are somehow present. Here is a var_dump() of the PageImage object:

object(ProcessWire\Pageimage)#390 (2) {
  ["hooks"]=>
  array(12) {
    ["property Pageimage->copyright"]=>
    string(41) "anonymous function() in ImageExtra.module"
    ["Pageimage::copyright"]=>
    string(50) "ImageExtra->addCustomMethod() in ImageExtra.module"
    ["property Pageimage->Bildunterschrift"]=>
    string(41) "anonymous function() in ImageExtra.module"
    ["Pageimage::Bildunterschrift"]=>
    string(50) "ImageExtra->addCustomMethod() in ImageExtra.module"
    ["property Pageimage->Quelle_Fotograf"]=>
    string(41) "anonymous function() in ImageExtra.module"
    ["Pageimage::Quelle_Fotograf"]=>
    string(50) "ImageExtra->addCustomMethod() in ImageExtra.module"
    ["property Pageimage->Dateipfad"]=>
    string(41) "anonymous function() in ImageExtra.module"
    ["Pageimage::Dateipfad"]=>
    string(50) "ImageExtra->addCustomMethod() in ImageExtra.module"
    ["property Pageimage->orientation"]=>
    string(41) "anonymous function() in ImageExtra.module"
    ["Pageimage::orientation"]=>
    string(49) "ImageExtra->addOrientation() in ImageExtra.module"
    ["property Pageimage->link"]=>
    string(41) "anonymous function() in ImageExtra.module"
    ["Pageimage::link"]=>
    string(42) "ImageExtra->addLink() in ImageExtra.module"
  }
  ["data"]=>
  array(6) {
    ["basename"]=>
    string(14) "filename.jpg"
    ["description"]=>
    string(0) ""
    ["tags"]=>
    string(0) ""
    ["formatted"]=>
    bool(false)
    ["modified"]=>
    int(0)
    ["created"]=>
    int(0)
  }
}

Seems like a trivial task, maybe you only have to run something like $oPageImage->init(), but I couldn’t fix this :-(

nikosch commented 8 years ago

I have no idea why I had to do it that way, but this problem should be solved. Please check it out in your environment.

gerritvanaaken commented 8 years ago

Metadata is being applied now! Great!