Kirby 3 upgrade help

I’m upgrading from Kirby 2 to Kirby 3 ny reading the Kirby 3 upgrade guide, but I’ve run into 2 major issues:

  1. All of the images no longer appear. I have created the “media” folder with full permissions, but the images on my pages all reference files in the media folder that do not exist. Can I just use the “old” “content” folder approach? Alternatively, it seems like the media folder is just a cache – how do I make it generate the images on demand?

  2. In trying to resolve this issue, I tried making a Panel account (I’ve never used Panel before). I get this error when trying to create the account after entering a name/email/password: Call to a member function (pattern() on null. Any ideas?


What is your environment?

PHP 7.1.5
Ubuntu 18.04 LTS

I meant more the server, Apache or nginx; remote server or local development environment? If the latter, what exactly?

Images should be auto-generated in the media folder on demand when their URL is called in the frontend.

If you want to create a Panel account on a remote server, you have to allow installation in your config.php first, using the panel.install option.

Pardon the delay. Using Apache on a remote Linux server.

I reset the permissions on everything and was able to create a panel account successfully.

I also figured out the cause of the broken images everywhere, but I’m unable to find a solution. I am using this - -on the server to serve 2x “retina”-capable graphics (image2x.png vs image.png) to those who can view them (it changes the reference from image.png to image2x.png using a URL rewrite if it is best for the user’s browser – which used to work fine because everything was available in the content folder). But the new implementation in Kirby 3 only creates media files for files that are explicitly referenced in the markdown file. So, the images are all broken if viewed on a “retina” machine.

Is there a better way I could handle this?

You could turn back to the old behaviour of serving files from the content folder: Image URLs - How to remove string?

But I’d rather use the image srcset attribute to serve the 2x version, you could modify the image KirbyTag to achieve that.

On the other hand, if you want to serve responsive images, would it make more sense to use Kirby’s thumbnail engine to produce a srcset of images that fit in size and resolution?

Thanks for the reply – the image srcset attribute is a good way to go, I’ll do that – thanks!

The original issue with my post where I was received the error Call to a member function (pattern() on null when creating my panel account keeps coming up. What’s the next step for me to troubleshoot this? I can’t reliably see when it occurs or does not occur.

In the Panel context, the only context that could possibly come from is probably the pattern function called in the Language class. Are you using a multi-language installation? Are the languages correctly defined?

This is the result of simply installing the starterkit with no modifications. I don’t believe that includes multi-language?

I just identified the issue – I had installed the no modifications except for the .htaccess file, which contained some additions, including this which was breaking it:

Force trailing slash

RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]

Removing this resolved the issue, so it’s clearly something with my configuration and it’s all resolved. Thanks for the help.

I use the following in my own site, which i tweaked the last line to add the trailing slash. Maybe this will work for you…

RewriteCond %{HTTP_HOST} !=localhost
RewriteCond %{HTTP_HOST} ^www\. [NC,OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI}/ [R=301,L,NE]