Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class 'Timmy\Image' not found when using v1.0 #60

Open
jeroenbraspenning opened this issue Jul 4, 2023 · 1 comment
Open

Class 'Timmy\Image' not found when using v1.0 #60

jeroenbraspenning opened this issue Jul 4, 2023 · 1 comment

Comments

@jeroenbraspenning
Copy link

Today i gave the v1.0 a spin but i get the following error:
Fatal error: Uncaught Error: Class 'Timmy\Image' not found in /var/www/html/wp-content/plugins/timmy-1.0.0/lib/Timmy.php:161 Stack trace: #0 /var/www/html/wp-content/themes/yk/template-home.php(10): Timmy\Timmy::get_image(260, 'nocrop') #1 /var/www/html/wp-includes/template-loader.php(106): include('/var/www/html/w...') #2 /var/www/html/wp-blog-header.php(19): require_once('/var/www/html/w...') #3 /var/www/html/index.php(17): require('/var/www/html/w...') #4 {main} thrown in /var/www/html/wp-content/plugins/timmy-1.0.0/lib/Timmy.php on line 161

I installed Timmy as a plugin without composer and initialized Timmy (simplified) as follows:

use Timmy\Timmy;
Timmy::init();
$image = Timmy::get_image(260, 'nocrop');

When taking a look at Timmy.php is see the following:

$class = apply_filters( 'timmy/image/class', Image::class );
$size_array = $size;

if ( is_string( $size ) ) {
if ( in_array( $size, [ 'full', 'original' ], true ) ) {
	$size_array = [];
} else {
	$size_array = Helper::get_image_size( $size );
}
}
$image = $class::build( $attachment, $size_array );

The last line is line 161

Is there anything else i can try to debug this issue?

Timmy version: 1.0
Timber version: 1.22.1

@gchtr
Copy link
Member

gchtr commented Jul 14, 2023

I’m sorry that I neglected the plugin version a bit.

I think you run into an error where Timmy doesn’t have an autoloader, which is handled through Composer even in the plugin version. But that isn’t loaded correctly yet. I’ll have to fix that.

For now, only the installation through Composer seems to work correctly for 1.x: https://github.com/mindkomm/timmy/blob/1.x/docs/installation.md#install-with-composer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants