mplodowski / seomanager-plugin-public

https://octobercms.com/plugin/renatio-seomanager
https://octobercms.com/plugin/renatio-seomanager
4 stars 1 forks source link

An exception has been thrown during the rendering of a template #14

Closed panki3a closed 3 years ago

panki3a commented 4 years ago

We got this exception when we render static page: An exception has been thrown during the rendering of a template ("call_user_func_array() expects parameter 1 to be a valid callback, class 'Cms\Classes\Controller' does not have a method 'og_image_width'").

This is happening, when you have different environments . I upload OG IMAGE on LOCAL stage, then I commit this static page and deploy it to the TEST stage. The image doesn't exist on TEST stage storage, so you will get this fatal error.

The solution can be put some IF condition into plugins/renatio/seomanager/components/seotags/default.htm if image exist.

nizzac commented 3 years ago

I'm also seeing this error also.

It seems to be when the seoTag property on the SeoTags component is set to be $this->page

For pages where there's a model that implements the SeoTag model, things work fine.

nizzac commented 3 years ago

Ok for me, this all boils down to the changes in the config files in October 2.

The media path is no longer stored in config('cms.storage.media.path') it's now in config('system.storage.media.path')

So when the component runs the setOgImageDimensions method - is_file($filePath) is returning false, so og_image_width and og_image_height are never set.

So checking for image existence in the component returns true, but it's looking for og_image_width on the Controller class - that doesn't exist so throws an error.

nizzac commented 3 years ago

A fix has been suggested here

https://github.com/mplodowski/seomanager-plugin-public/issues/16#issuecomment-893258817

mplodowski commented 3 years ago

Thank you for this. Fixed in version 1.3.4.