Some Images Not Showing after Ver 9 Upgrade

This has happened on a few of my recent upgrade attempts, going from Version 8.5.12 to Version 9.1.3. Everything seems to be working accept images - but some show and other do not. When you edit the page and then edit a particular block, the image reference is present and you can go to files and see the image, but it will not show on the front end after publishing. I have cleared site cache, server cache and browser cache and nothing seems to work. I have deleted an image block and published the page, and then put it back in fresh and published, still not working. The only consistency I can see is it usually on the home page in a hero area, or image slider or special callout box.

Example site: https://btlaunch.com/ersv9/
(There should be a hero image at the top)

(There should be images in all the white boxes. If you edit one, the image reference is there and it even shows the thumbnail, but not in the front end.)

Any assistance would be greatly appreciated as I am banging my head against the wall on this. I have multiple websites to upgrade and this is a problem.

1 Like

If you check the block template I would be willing to bet you will find a line like this

$app->make('html/image', [$f]);

In v9 it needs to be

$app->make('html/image', ['f' => $f]);

Your variables might be different and you might have Core:: instead of $app-> but that html/image line is likely your issue.

2 Likes

Thanks much! That fixed the box images.

On the home page hero, I have identified this line in the block template:

$tag = Core::make(‘html/image’, [$f, false])->getTag();

How should that be re-written?

I did this and it worked. Thanks again, a life saver!

Old: $tag = Core::make(‘html/image’, [$f, false])->getTag();
New: $tag = Core::make(‘html/image’,[‘f’ => $f, false])->getTag();

1 Like

Just a quick FYI your correction is still not totally correct.
The difference between the old way and the new way is you have to tell the method the name of the parameters. In your correction, your false parameters will not be used as you didn’t give it its name. It might not impact the result if the parameter is set to false by default for instance.

In your case your are calling this __construct method

<?php
/**
     * @param \Concrete\Core\Entity\File\File $f
     * @param array|bool|null $options Use NULL to use the default options, a boolean (deprecated) to use a `picture` tag (TRUE) or an `img` tag (FALSE), or an array with these values:
     * <ul>
     *     <li>bool|null `usePictureTag`: TRUE (use a `picture` tag), FALSE (use an `img` tag), NULL or not specified use the settings from the current page theme</li>
     *     <li>bool|null `lazyLoadNative`: If TRUE the `loading="lazy"` attribute will be added to the `img`</li>
     *     <li>bool|null `lazyLoadJavaScript`: If TRUE set the img `src` and/or source `srcset` image file path to `data-src` and/or `data-srcset` </li>
     * </ul>
     */
    public function __construct(File $f = null, $options = null)
    {
        if (!is_object($f)) {
            return false;
        }
       // rest of the code
    }

So your second parameters (false) is named “options” and without a value, it reverts to default options as explained in the comments.