Class 'Kirby\Image\image' not found

I’m using the following code to include some social share SVG’s into a snippet:

<a href='https://twitter.com/intent/tweet' target='_blank' class='svg-icons'>
    <?= (new Kirby\Image\image('assets/images/twitter.svg'))->read() ?>
</a>

On my local development system (os x), everything is working fine.

nginx version: nginx/1.15.12

PHP 7.3.5 (cli) (built: May  2 2019 12:40:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies
  with Zend OPcache v7.3.5, Copyright (c) 1999-2018, by Zend Technologies

On my production server (Linux):

nginx version: nginx/1.16.0

PHP 7.3.5 (cli) (built: Apr 30 2019 21:05:09) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies
  with Zend OPcache v7.3.5, Copyright (c) 1999-2018, by Zend Technologies

I get the following error:

Error thrown with message "Class 'Kirby\Image\image' not found"

Stacktrace:
#11 Error in /data/www/site/snippets/social.php:4
#10 require in /data/www/kirby/src/Toolkit/Tpl.php:39
#9 Kirby\Toolkit\Tpl:load in /data/www/kirby/config/components.php:144
#8 Kirby\Cms\App:{closure} in /data/www/kirby/src/Cms/App.php:1137
#7 Kirby\Cms\App:snippet in /data/www/kirby/config/helpers.php:683
#6 snippet in /data/www/site/templates/note.php:21
#5 require in /data/www/kirby/src/Toolkit/Tpl.php:39
#4 Kirby\Toolkit\Tpl:load in /data/www/kirby/src/Cms/Template.php:164
#3 Kirby\Cms\Template:render in /data/www/kirby/src/Cms/Page.php:1151
#2 Kirby\Cms\Page:render in /data/www/kirby/src/Cms/App.php:575
#1 Kirby\Cms\App:io in /data/www/kirby/src/Cms/App.php:838
#0 Kirby\Cms\App:render in /data/www/index.php:5

Any idea where to search for the error?

Try a capital I (Unix systems are often case sensitive, so what works for you locally doesn’t work remote).

 <?= (new Kirby\Image\Image('assets/images/twitter.svg'))->read() ?>

It’s easier to use the svg() helper:

<?= svg('assets/images/twitter.svg') ?>
1 Like

You are awesome :kissing_heart:

Thanks for the quick solution and the improvement hint, much appreciated.