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

Images not being generated #103

Closed
andylarkum opened this issue Jun 23, 2022 · 11 comments · Fixed by #104
Closed

Images not being generated #103

andylarkum opened this issue Jun 23, 2022 · 11 comments · Fixed by #104

Comments

@andylarkum
Copy link

andylarkum commented Jun 23, 2022

This is a recent issue (like, has only been a problem in the last couple of weeks).

Running php please ssg:generate isn't generating the image files for newly added content. Anything older than a couple of weeks ago is working fine, but anything added in the last couple of weeks fails to create.

For clarity, the local "live" version of the site works fine, the static version is missing the new images.

No idea where to start debugging this - any pointers/things I can try?

@joshuablum
Copy link
Member

Hey @andylarkum,

What's the output of php please support:details?
And what do your config files look like? Specifically config/statamic/assets.php & config/statamic/ssg.php

@andylarkum
Copy link
Author

andylarkum commented Jun 24, 2022

Hi @joshuablum

Thanks for getting back to me here. Results:

php please support:details says:

Laravel 8.83.17
PHP 8.0.19
cnj/seotamic 2.0.6
octoper/statamic-html-minify 0.0.5
pecotamic/sitemap 1.4.0
rias/statamic-redirect 2.3.6
statamic/ssg 1.0.1

confic/statamic/assets.php stripped of comments:

return [
    'image_manipulation' => [
        'route' => 'img',
        'secure' => true,
        'driver' => 'gd',
        'cache' => false,
        'cache_path' => public_path('img'),
        'presets' => [
            'xs-webp' => ['w' => 320, 'h' => 10000, 'q' => 85, 'fit' => 'contain', 'fm' => 'webp'],
            'sm-webp' => ['w' => 480, 'h' => 10000, 'q' => 85, 'fit' => 'contain', 'fm' => 'webp'],
            'md-webp' => ['w' => 768, 'h' => 10000, 'q' => 85, 'fit' => 'contain', 'fm' => 'webp'],
            'lg-webp' => ['w' => 1280, 'h' => 10000, 'q' => 85, 'fit' => 'contain', 'fm' => 'webp'],
            'xl-webp' => ['w' => 1440, 'h' => 10000, 'q' => 95, 'fit' => 'contain', 'fm' => 'webp'],
            '2xl-webp' => ['w' => 1680, 'h' => 10000, 'q' => 95, 'fit' => 'contain', 'fm' => 'webp'],
            'xs' => ['w' => 320, 'h' => 10000, 'q' => 85, 'fit' => 'contain'],
            'sm' => ['w' => 480, 'h' => 10000, 'q' => 85, 'fit' => 'contain'],
            'md' => ['w' => 768, 'h' => 10000, 'q' => 85, 'fit' => 'contain'],
            'lg' => ['w' => 1280, 'h' => 10000, 'q' => 85, 'fit' => 'contain'],
            'xl' => ['w' => 1440, 'h' => 10000, 'q' => 95, 'fit' => 'contain'],
            '2xl' => ['w' => 1680, 'h' => 10000, 'q' => 95, 'fit' => 'contain'],
        ],
    ],
    'auto_crop' => true,
    'thumbnails' => [
        'max_width' => 10000,
        'max_height' => 10000,
    ],
    'google_docs_viewer' => false,
    'cache_meta' => true,
];

...and config/statamic/ssg.php:

return [
    'base_url' => config('app.url'),
    'destination' => storage_path('app/static'),
    'copy' => [
        public_path('css') => 'css',
        public_path('js') => 'js',
        public_path('assets') => 'assets',
        public_path('fonts') => 'fonts',
    ],
    'symlinks' => [
        // public_path('css') => 'css',
        // public_path('js') => 'js',
    ],
    'urls' => [
        '/posts',
        'sitemap.xml',
        'robots.txt'
    ],
    'exclude' => [
        //
    ],
    'glide' => [
        'directory' => 'img',
    ],
    'failures' => false, // 'errors' or 'warnings'
];

@joshuablum
Copy link
Member

joshuablum commented Jun 24, 2022

Thanks for providing those details! Config looks fine to me.

What's interesting: Someone else that ran into this issue (or at least very similar) was also on Laravel 8 and PHP 8.0. If it's not too much work, could you try upgrading to Laravel 9 and PHP 8.1?

@andylarkum
Copy link
Author

OKey doke

I've updated to Laravel 9 and PHP 8.1, regenerated and re-synched to AWS S3.
Now just need for cloudfront to update :)

I'll update soon...

A.

@andylarkum
Copy link
Author

Nope

Still no images.

Stumped

@joshuablum
Copy link
Member

Thanks for the update and for upgrading to Laravel 9 and PHP 8.1!

Are you running the plain php please ssg:generate command or are you also passing the --workers argument to it? If you're using workers, could you try to run it without them.

@andylarkum
Copy link
Author

Yup, just generate, no workers

@jasonvarga
Copy link
Member

jasonvarga commented Jun 28, 2022

Where are you running the ssg:generate command? On production? Locally?

If you run php artisan cache:clear before ssg:generate, do the new images appear?

I think if you clear your Glide cache (using php please glide:clear), the images should appear next time you generate the site.

@andylarkum
Copy link
Author

Hi @jasonvarga
Running ssg:generate on local

I discovered that I have to run php please cache:clear before AND after ssg:generate, otherwise

  1. generate fails; and
  2. the local site errors afterwards

...but, perhaps I'll get a different result with php artisan cache:clear?

@globalexport
Copy link

Hi @andylarkum,

Are the images physically missing in the generated folder, or do you maybe experience the same behaviour in HTML I found with using the spatie responsive image plugin after the update: spatie/statamic-responsive-images#146

@andylarkum
Copy link
Author

Hi all

@globalexport and @jasonvarga - my apologies for not replying sooner. Composer broke - and I've not been able to resolve it yet (throw in a holiday for delay!)

In case anyone cares, composer error is:
PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.14.

...which is very annoying, as I've apt remove'd all other versions of PHP other than 8.1!

Anyways, I'm believing that the #146 solutions will have solved it once I can get sail up and running again...

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

Successfully merging a pull request may close this issue.

4 participants