<![CDATA[ ImagePlus Default Operation - nothing created - My Forums]]> https://forums.modx.com/thread/?thread=102472 <![CDATA[ImagePlus Default Operation - nothing created]]> https://forums.modx.com/thread/102472/imageplus-default-operation---nothing-created#dis-post-552119
Using ImagePlus with a default like subfolder/picture.jpg and pThumb with Cache pthumb.use_ptcache so image should appear in assets/image-cache.
Using Media-Sources too with basepath baseurl set to assets/img/ (relative) - which may be relevant.

I've tried two approaches and expect both to fall back on the default if nothing added to the TV on the resource. But they don't, and show slightly different outputs.

Approach 1) TV1 has input/output set to Image+. A Default as above. And output tab has no phpthumb params, no output chunk and Generate Thumb is No.
Then in Template/Chunk a snippet call
[[ImagePlus? &tvname=`tvImage1` &options=`&h=200` &type=`tpl` &tpl=`tripleImagePlus-srcset` ]]

Where tripleImagePlus-srcset is much the same as in the Responsive Image <picture> part of the example http://jako.github.io/ImagePlus/examples/

This works when an image is added to the TV in a Resource. But nothing is output when the TV is left blank - no html - just a hole in my site. Expected the picture element using the default image.

Approach 2) Another Image+ Input/Output TV with a Default as above and this time the Output Chunk is set to tripleImagePlus-srcset
Then in the Template a simple [[*tvImage2]]. Does the trick if an image is added in the Resource TV. Good.
And it has a path like www.domain.com/assets/image-cache/picture.049cb573.jpg

This time though, when the Image+ TV is left blank you see a simple string in the browser which is the default e.g. subfolder/picture.jpg. In other words the Output Chunk is ignored. But at least it has a go at getting a default. However, the Media Source isn't added ( assets/img/)

I think this is related to these issues
https://github.com/Jako/ImagePlus/issues/59 which resulted in 2.6.3 And this epic
https://github.com/Jako/ImagePlus/issues/41 which led to commits around Oct 1, 2016


I always make a mess of leading/trailing slashes so I may have got something wrong there but what I think is happening is:

core/components/imageplus/model/cropengines/PhpThumbOf.php line 130
if (file_exists($imgPath)) {
   // run phpthumbof stuff
 } else {
    $url = $data->sourceImg->src
}


I think Jako did this to stop phpthumbof running when a default is used as it could end up showing the full server path - not good.
And the sourceImg->src is presumably my default value which simply gets passed through. Missing the media-source bit.

With Approach 2) it looks like the Output Chunk doesn't run so I don't get the <picture> stuff.
With Approach 1) nothing appears, not even the string of the default.

I suspect there is a logic in the default iamge not being processed by any imageplus/phpthumb stuff as by definition it can't have been cropped or whatever so should simply be passed through as is. But I'd have thought that something should make it through to the Chunk Template referenced in either &tpl or the Output Chunk.

UPDATE
Spotted this in the Error Log: (ERROR in Image+ @ /home/.../core/components/imageplus/model/cropengines/PhpThumbOf.php : 54)
The value is empty. Could not prepare the output.

Had a look but it seems the imageplus code gives up very early if there is no source.

UPDATE 2
Found this public $version = '2.6.2'; in core/components/imageplus/model/imageplus/imageplus.class.php yet system claims to be up to date with 2.6.3.

Revo 2.5.6. Imageplus 2.6.3

Parthian]]>
parthian Jun 28, 2017, 02:11 PM https://forums.modx.com/thread/102472/imageplus-default-operation---nothing-created#dis-post-552119