The default version of helper.php in the last released version does not appear to support 'firstimage' functionality.
Line 95 & 96:
function getImageID($id,$flags=array()){
$flags = array_merge(array('firstimage' => false),$flags);
... means that the retrieval of the first image on line 105 $src = p_get_metadata($id,'relation firstimage'); never returns an image due to the test on the 'firstimage' flag (which is being defined as false) on line 106.
In my deployment I have hundreds of wiki pages already, and I do not wish to revisit each in turn to define a PAGEIMAGE, nor do I have a consistent name for each first image, and relying on 'firstimage' is therefore necessary.
Altering the defaults on line 96 to:
function getImageID($id,$flags=array()){
$flags = array_merge(array('firstimage' => true),$flags);
Fixes this broken behaviour, and pages which do not have an explicit PAGEIMAGE defined now correctly return the first JPG/JPEG/PNG which is found on the page, if all other methods of deriving a PAGEIMAGE fail (as I'm sure the code was intended to work).
Ideally, I would expect 'firstimage' to be a configuration parameter and sourced from local.php. Though if anyone is still using pageimage (it's very useful in combination with pagelist) this is why 'firstimage' behaviour does not work.
The default version of
helper.phpin the last released version does not appear to support 'firstimage' functionality.Line 95 & 96:
... means that the retrieval of the first image on line 105
$src = p_get_metadata($id,'relation firstimage');never returns an image due to the test on the 'firstimage' flag (which is being defined as false) on line 106.In my deployment I have hundreds of wiki pages already, and I do not wish to revisit each in turn to define a PAGEIMAGE, nor do I have a consistent name for each first image, and relying on 'firstimage' is therefore necessary.
Altering the defaults on line 96 to:
Fixes this broken behaviour, and pages which do not have an explicit PAGEIMAGE defined now correctly return the first JPG/JPEG/PNG which is found on the page, if all other methods of deriving a PAGEIMAGE fail (as I'm sure the code was intended to work).
Ideally, I would expect 'firstimage' to be a configuration parameter and sourced from local.php. Though if anyone is still using pageimage (it's very useful in combination with pagelist) this is why 'firstimage' behaviour does not work.