felixpfeiffer / Contao-NewsSimple

0 stars 1 forks source link

[Contao 3.3.0] getimagesize() warning #1

Open rocchidavide opened 10 years ago

rocchidavide commented 10 years ago

In the news edit: 1) add an image and populate newsText textarea, 2) save 3) load a frontend page where the news is present (teaser or full is not important)

I obtain:

Warning: getimagesize(/path/to/site/q������I��4�R): failed to open stream: No such file or directory in system/modules/core/library/Contao/Controller.php on line 2475

rocchidavide commented 10 years ago

Debugging the code I saw that the problem is that 'singleSRC' attribute is a uuid, not a path. In file news_simple/classes/NewsSimple.php:

            // Add an image
            if ($arrArticle['addImage'])
            {
                $arrImage = $arrArticle;
                $arrImage['title'] = $arrArticle['alt'];

                $objFile = \FilesModel::findByUuid($arrImage['singleSRC']);
                $arrImage['singleSRC'] = $objFile->path;

                $this->addImageToTemplate($objTemplate, $arrImage);
            }

Doing so, warning is corrected. But I have two images in my news! Is it necessary this if block?

felixpfeiffer commented 10 years ago

Hello,

I just don't get what you try to do. You can only add one image to the simple news - as it was in the contao pre 3 versions. So, this if-clause is important, to see, if ther is an image selected.

How do you add two images??