nystudio107 / craft-imageoptimize

Automatically create & optimize responsive image transforms, using either native Craft transforms or a service like Imgix, with zero template changes.
https://nystudio107.com/plugins/imageoptimize
Other
235 stars 36 forks source link

Color palettes and lightness not generating #175

Closed stevehurst closed 4 years ago

stevehurst commented 5 years ago

I've never been able to get the color palettes and lightness values to generate for my assets where it's enabled. I'm not sure if Craft's built in image manipulator can't do it, or if I need to select a 3rd party image transform service? I've looked through the docs and the settings to make sure I'm not missing anything. I've attached the three relevant dashboard screens of settings. What else should I be doing to get this to work?

screencapture-kalypso-admin-settings-fields-edit-299-2019-10-23-08_35_16 screencapture-kalypso-admin-settings-plugins-image-optimize-2019-10-23-08_34_38 screencapture-kalypso-admin-utilities-system-report-2019-10-23-08_34_16

khalwat commented 5 years ago

Can you show me a screenshot of this not working? You should see something like this:

Screen Shot 2019-10-28 at 4 39 45 PM

stevehurst commented 5 years ago

Yep, here is what all my assets look like in those fields:

image

I'm not seeing any queue errors or anything. These two things have just never generated on my assets.

khalwat commented 5 years ago

So here's the code that generates the color palette:

    public function generateColorPalette(string $tempPath): array
    {
        Craft::beginProfile('generateColorPalette', __METHOD__);
        $colorPalette = [];
        if (!empty($tempPath)) {
            // Extract the color palette
            try {
                $palette = ColorThief::getPalette($tempPath, 5);
            } catch (\Exception $e) {
                Craft::error($e->getMessage(), __METHOD__);

                return [];
            }
            // Convert RGB to hex color
            foreach ($palette as $colors) {
                $colorPalette[] = sprintf('#%02x%02x%02x', $colors[0], $colors[1], $colors[2]);
            }
        }
        Craft::endProfile('generateColorPalette', __METHOD__);

        return $colorPalette;
    }

-> https://github.com/nystudio107/craft-imageoptimize/blob/v1/src/services/Placeholder.php#L105

So either there is no $tempPath being passed in, or ColorThief throws an error (in which case there should be something in your logs).

Do you at least see the profiling comment for generateColorPalette in your logs?

I'm going to assume that whatever this is, it's going to end up being some kind of issue with your local environment, either your PHP install/setup or your Imagick/GS install/setup.

stevehurst commented 5 years ago

Which log should I look in to find the profiling comment?

And to clarify, this is happening on both my local environment, as well as production on ArcusTech.

stevehurst commented 5 years ago

I looked through a few different logs, and didn't find reference to generateColorPalette

Looking in imageresizer.log, I see a lot of this error:

{"dateTime":"2019-10-28 15:45:15","taskId":null,"handle":"error","filename":"PLM-EIM.jpg","data":{"message":"Unable to find path: "}}

khalwat commented 5 years ago

I'm not sure, perhaps try disabling ImageResizer and see if the issue goes away?

khalwat commented 5 years ago

Will re-open if additional information comes to light

stevehurst commented 5 years ago

I disabled ImageResizer, and still nothing on palettes or lightness generation. Here is the item from the queue.log file. It looks like color and lightness aren't being called?

2019-11-08 09:18:50 [-][1][-][info][nystudio107\imageoptimize\services\OptimizedImages::addVariantImageToModel] URL created: https://kalypso.com/images/splash/_900x562_crop_center-center_60_line/GettyImages-1070718094.jpg
2019-11-08 09:18:50 [-][1][-][info][nystudio107\imageoptimize\services\OptimizedImages::addVariantImageToModel] Created transforms for variant: Array
(
    [width] => 900
    [useAspectRatio] => 1
    [aspectRatioX] => 8
    [aspectRatioY] => 5
    [retinaSizes] => Array
        (
            [0] => 1
        )

    [quality] => 60
    [format] => jpg
)

2019-11-08 09:18:50 [-][1][-][info][craft\queue\QueueLogBehavior::afterExec]  [6415] Optimizing image id 174822 (attempt: 1) - Done (time: 0.033s)
2019-11-08 09:18:50 [-][1][-][info][craft\queue\QueueLogBehavior::beforeExec]  [6416] Updating search indexes (attempt: 1) - Started
2019-11-08 09:18:50 [-][1][-][info][craft\queue\QueueLogBehavior::afterExec]  [6416] Updating search indexes (attempt: 1) - Done (time: 0.011s)
2019-11-08 09:18:50 [-][1][-][info][craft\queue\QueueLogBehavior::beforeExec]  [6417] Updating search indexes (attempt: 1) - Started
2019-11-08 09:18:50 [-][1][-][info][craft\queue\QueueLogBehavior::afterExec]  [6417] Updating search indexes (attempt: 1) - Done (time: 0.044s)
2019-11-08 09:18:50 [-][1][-][info][craft\queue\QueueLogBehavior::beforeExec]  [6418] Deleting stale template caches (attempt: 1) - Started
2019-11-08 09:18:50 [-][1][-][info][craft\queue\QueueLogBehavior::afterExec]  [6418] Deleting stale template caches (attempt: 1) - Done (time: 0.001s)
stevehurst commented 4 years ago

Following up on this since I provided more information above. This feature still isn't working and we'd really like to use it.

khalwat commented 4 years ago

@stevehurst can making sure that the Create Color Palette is properly set in your config/image-optimize.php file (from the screenshot, it looks like it is, but double-check).

Then try this new CLI command to force-regenerate the images:

php craft image-optimize/optimize/create --force

ref: https://nystudio107.com/docs/image-optimize/Using.html#command-line-optimized-image-variant-creation

stevehurst commented 4 years ago

@khalwat I got this error:

Error: Unknown option: --force. Options available: --color, --interactive, --help, --silentExitOnException

But I ran

php craft image-optimize/optimize/create --color

It seemed to work through all of our images, but no change in the data.

image

The queue.log doesn't seem to have much of value. Here is a sample:

#1 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/imagetransforms/CraftImageTransform.php(65): craft\services\Assets->getAssetUrl(Object(craft\elements\Asset), Object(craft\models\AssetTransform), true)
#2 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(477): nystudio107\imageoptimize\imagetransforms\CraftImageTransform->getTransformUrl(Object(craft\elements\Asset), Object(craft\models\AssetTransform))
#3 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(105): nystudio107\imageoptimize\services\OptimizedImages->addVariantImageToModel(Object(craft\elements\Asset), Object(nystudio107\imageoptimize\models\OptimizedImage), Object(craft\models\AssetTransform), Array, 1.7777777777778)
#4 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(219): nystudio107\imageoptimize\services\OptimizedImages->populateOptimizedImageModel(Object(craft\elements\Asset), Array, Object(nystudio107\imageoptimize\models\OptimizedImage))
#5 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/jobs/ResaveOptimizedImages.php(86): nystudio107\imageoptimize\services\OptimizedImages->updateOptimizedImageFieldData(Object(nystudio107\imageoptimize\fields\OptimizedImages), Object(craft\elements\Asset))
#6 /storage/XXXX/www/public_html/vendor/yiisoft/yii2-queue/src/Queue.php(246): nystudio107\imageoptimize\jobs\ResaveOptimizedImages->execute(Object(craft\queue\Queue))
#9 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/console/controllers/OptimizeController.php(91): craft\queue\Queue->run()
#10 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/console/controllers/OptimizeController.php(61): nystudio107\imageoptimize\console\controllers\OptimizeController->runCraftQueue()
#11 [internal function]: nystudio107\imageoptimize\console\controllers\OptimizeController->actionCreate(NULL)
#7 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/imagetransforms/CraftImageTransform.php(65): craft\services\Assets->getAssetUrl(Object(craft\elements\Asset), Object(craft\models\AssetTransform), true)
#8 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(477): nystudio107\imageoptimize\imagetransforms\CraftImageTransform->getTransformUrl(Object(craft\elements\Asset), Object(craft\models\AssetTransform))
#9 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(105): nystudio107\imageoptimize\services\OptimizedImages->addVariantImageToModel(Object(craft\elements\Asset), Object(nystudio107\imageoptimize\models\OptimizedImage), Object(craft\models\AssetTransform), Array, 1.7777777777778)
#10 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(219): nystudio107\imageoptimize\services\OptimizedImages->populateOptimizedImageModel(Object(craft\elements\Asset), Array, Object(nystudio107\imageoptimize\models\OptimizedImage))
#11 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/jobs/ResaveOptimizedImages.php(86): nystudio107\imageoptimize\services\OptimizedImages->updateOptimizedImageFieldData(Object(nystudio107\imageoptimize\fields\OptimizedImages), Object(craft\elements\Asset))
#12 /storage/XXXX/www/public_html/vendor/yiisoft/yii2-queue/src/Queue.php(246): nystudio107\imageoptimize\jobs\ResaveOptimizedImages->execute(Object(craft\queue\Queue))
#15 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/console/controllers/OptimizeController.php(91): craft\queue\Queue->run()
#16 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/console/controllers/OptimizeController.php(61): nystudio107\imageoptimize\console\controllers\OptimizeController->runCraftQueue()
#17 [internal function]: nystudio107\imageoptimize\console\controllers\OptimizeController->actionCreate(NULL)
#5 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/imagetransforms/CraftImageTransform.php(65): craft\services\Assets->getAssetUrl(Object(craft\elements\Asset), Object(craft\models\AssetTransform), true)
#6 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(477): nystudio107\imageoptimize\imagetransforms\CraftImageTransform->getTransformUrl(Object(craft\elements\Asset), Object(craft\models\AssetTransform))
#7 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(105): nystudio107\imageoptimize\services\OptimizedImages->addVariantImageToModel(Object(craft\elements\Asset), Object(nystudio107\imageoptimize\models\OptimizedImage), Object(craft\models\AssetTransform), Array, 1.7777777777778)
#8 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(219): nystudio107\imageoptimize\services\OptimizedImages->populateOptimizedImageModel(Object(craft\elements\Asset), Array, Object(nystudio107\imageoptimize\models\OptimizedImage))
#9 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/jobs/ResaveOptimizedImages.php(86): nystudio107\imageoptimize\services\OptimizedImages->updateOptimizedImageFieldData(Object(nystudio107\imageoptimize\fields\OptimizedImages), Object(craft\elements\Asset))
#10 /storage/XXXX/www/public_html/vendor/yiisoft/yii2-queue/src/Queue.php(246): nystudio107\imageoptimize\jobs\ResaveOptimizedImages->execute(Object(craft\queue\Queue))
#13 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/console/controllers/OptimizeController.php(91): craft\queue\Queue->run()
#14 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/console/controllers/OptimizeController.php(61): nystudio107\imageoptimize\console\controllers\OptimizeController->runCraftQueue()
#15 [internal function]: nystudio107\imageoptimize\console\controllers\OptimizeController->actionCreate(NULL)
khalwat commented 4 years ago

Please update to the latest ImageOptimize to get the --force option, and try again

stevehurst commented 4 years ago

Will do and report back. I resaved an image in the admin panel and here is the log from that:

2020-10-28 10:41:57 [-][1][-][info][nystudio107\imageoptimize\services\OptimizedImages::shouldCreateVariants] Array
(
)

2020-10-28 10:41:57 [-][1][-][info][nystudio107\imageoptimize\services\OptimizedImages::addVariantImageToModel] URL created: https://kalypso.com/images/splash/_300x168_crop_center-center_60_line/362262/DigitalTires.jpg
2020-10-28 10:41:57 [-][1][-][info][nystudio107\imageoptimize\services\OptimizedImages::addVariantImageToModel] Created transforms for variant: Array
(
    [width] => 300
    [useAspectRatio] => 1
    [aspectRatioX] => 16
    [aspectRatioY] => 9
    [retinaSizes] => Array
        (
            [0] => 1
            [1] => 2
        )

    [quality] => 60
    [format] => jpg
)
stevehurst commented 4 years ago

@khalwat I updated the plugin and ran the console command. There doesn't appear to be a difference or change. The queue log looks the same as above. Is there something else I should look for?

khalwat commented 4 years ago

Okay, so I added additional logging so we can try to see what's going on here... edit your package.json to change the semver to be:

    "nystudio107/craft-imageoptimize": "dev-develop as 1.6.20",

...and then do a composer update and recreate the variants again via CLI command, and let's see if we don't get more information logged.

It's likely easiest to delete all of your logs before you run the CLI command to regenerate the images.

stevehurst commented 4 years ago

@khalwat here is a sample of a couple of errors I'm now seeing in queue.log when I run the regeneration command

2020-10-29 21:03:54 [-][-][-][error][craft\errors\VolumeObjectNotFoundException] League\Flysystem\FileNotFoundException: File not found at path: _900x506_crop_center-center_60_line/TransformativeInnovationData.jpg in /storage/XXXX/www/public_html/vendor/league/flysystem/src/Filesystem.php:389
Stack trace:
#0 /storage/XXXX/www/public_html/vendor/league/flysystem/src/Filesystem.php(223): League\Flysystem\Filesystem->assertPresent('_900x506_crop_c...')
#1 /storage/XXXX/www/public_html/vendor/craftcms/cms/src/base/FlysystemVolume.php(150): League\Flysystem\Filesystem->copy('_900x506_crop_c...', '_900x506_crop_c...')
#2 /storage/XXXX/www/public_html/vendor/craftcms/cms/src/services/AssetTransforms.php(801): craft\base\FlysystemVolume->copyFile('_900x506_crop_c...', '_900x506_crop_c...')
#3 /storage/XXXX/www/public_html/vendor/craftcms/cms/src/services/AssetTransforms.php(694): craft\services\AssetTransforms->_generateTransform(Object(craft\models\AssetTransformIndex))
#4 /storage/XXXX/www/public_html/vendor/craftcms/cms/src/services/Assets.php(620): craft\services\AssetTransforms->ensureTransformUrlByIndexModel(Object(craft\models\AssetTransformIndex))
#5 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/imagetransforms/CraftImageTransform.php(65): craft\services\Assets->getAssetUrl(Object(craft\elements\Asset), Object(craft\models\AssetTransform), true)
#6 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(518): nystudio107\imageoptimize\imagetransforms\CraftImageTransform->getTransformUrl(Object(craft\elements\Asset), Object(craft\models\AssetTransform))
#7 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(130): nystudio107\imageoptimize\services\OptimizedImages->addVariantImageToModel(Object(craft\elements\Asset), Object(nystudio107\imageoptimize\models\OptimizedImage), Object(craft\models\AssetTransform), Array, 1.7777777777778)
#8 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(251): nystudio107\imageoptimize\services\OptimizedImages->populateOptimizedImageModel(Object(craft\elements\Asset), Array, Object(nystudio107\imageoptimize\models\OptimizedImage), true)
#9 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/jobs/ResaveOptimizedImages.php(98): nystudio107\imageoptimize\services\OptimizedImages->updateOptimizedImageFieldData(Object(nystudio107\imageoptimize\fields\OptimizedImages), Object(craft\elements\Asset), true)
#10 /storage/XXXX/www/public_html/vendor/yiisoft/yii2-queue/src/Queue.php(246): nystudio107\imageoptimize\jobs\ResaveOptimizedImages->execute(Object(craft\queue\Queue))
#11 /storage/XXXX/www/public_html/vendor/yiisoft/yii2-queue/src/cli/Queue.php(147): yii\queue\Queue->handleMessage('11405', 'O:52:"nystudio1...', '300', 1)
#12 /storage/XXXX/www/public_html/vendor/craftcms/cms/src/queue/Queue.php(121): yii\queue\cli\Queue->handleMessage('11405', 'O:52:"nystudio1...', '300', 1)
#13 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/console/controllers/OptimizeController.php(128): craft\queue\Queue->run()
#14 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/console/controllers/OptimizeController.php(86): nystudio107\imageoptimize\console\controllers\OptimizeController->runCraftQueue()
#15 [internal function]: nystudio107\imageoptimize\console\controllers\OptimizeController->actionCreate(NULL)
#16 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#17 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#18 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/console/Controller.php(181): yii\base\Controller->runAction('create', Array)
#19 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('create', Array)
#20 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('image-optimize/...', Array)
#21 /storage/XXXX/www/public_html/vendor/craftcms/cms/src/console/Application.php(101): yii\console\Application->runAction('image-optimize/...', Array)
#22 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('image-optimize/...', Array)
#23 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#24 /storage/XXXX/www/public_html/craft(22): yii\base\Application->run()
#25 {main}

Next craft\errors\VolumeObjectNotFoundException: File not found at path: _900x506_crop_center-center_60_line/TransformativeInnovationData.jpg in /storage/XXXX/www/public_html/vendor/craftcms/cms/src/base/FlysystemVolume.php:154
Stack trace:
#0 /storage/XXXX/www/public_html/vendor/craftcms/cms/src/services/AssetTransforms.php(801): craft\base\FlysystemVolume->copyFile('_900x506_crop_c...', '_900x506_crop_c...')
#1 /storage/XXXX/www/public_html/vendor/craftcms/cms/src/services/AssetTransforms.php(694): craft\services\AssetTransforms->_generateTransform(Object(craft\models\AssetTransformIndex))
#2 /storage/XXXX/www/public_html/vendor/craftcms/cms/src/services/Assets.php(620): craft\services\AssetTransforms->ensureTransformUrlByIndexModel(Object(craft\models\AssetTransformIndex))
#3 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/imagetransforms/CraftImageTransform.php(65): craft\services\Assets->getAssetUrl(Object(craft\elements\Asset), Object(craft\models\AssetTransform), true)
#4 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(518): nystudio107\imageoptimize\imagetransforms\CraftImageTransform->getTransformUrl(Object(craft\elements\Asset), Object(craft\models\AssetTransform))
#5 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(130): nystudio107\imageoptimize\services\OptimizedImages->addVariantImageToModel(Object(craft\elements\Asset), Object(nystudio107\imageoptimize\models\OptimizedImage), Object(craft\models\AssetTransform), Array, 1.7777777777778)
#6 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/services/OptimizedImages.php(251): nystudio107\imageoptimize\services\OptimizedImages->populateOptimizedImageModel(Object(craft\elements\Asset), Array, Object(nystudio107\imageoptimize\models\OptimizedImage), true)
#7 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/jobs/ResaveOptimizedImages.php(98): nystudio107\imageoptimize\services\OptimizedImages->updateOptimizedImageFieldData(Object(nystudio107\imageoptimize\fields\OptimizedImages), Object(craft\elements\Asset), true)
#8 /storage/XXXX/www/public_html/vendor/yiisoft/yii2-queue/src/Queue.php(246): nystudio107\imageoptimize\jobs\ResaveOptimizedImages->execute(Object(craft\queue\Queue))
#9 /storage/XXXX/www/public_html/vendor/yiisoft/yii2-queue/src/cli/Queue.php(147): yii\queue\Queue->handleMessage('11405', 'O:52:"nystudio1...', '300', 1)
#10 /storage/XXXX/www/public_html/vendor/craftcms/cms/src/queue/Queue.php(121): yii\queue\cli\Queue->handleMessage('11405', 'O:52:"nystudio1...', '300', 1)
#11 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/console/controllers/OptimizeController.php(128): craft\queue\Queue->run()
#12 /storage/XXXX/www/public_html/vendor/nystudio107/craft-imageoptimize/src/console/controllers/OptimizeController.php(86): nystudio107\imageoptimize\console\controllers\OptimizeController->runCraftQueue()
#13 [internal function]: nystudio107\imageoptimize\console\controllers\OptimizeController->actionCreate(NULL)
#14 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#15 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#16 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/console/Controller.php(181): yii\base\Controller->runAction('create', Array)
#17 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('create', Array)
#18 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('image-optimize/...', Array)
#19 /storage/XXXX/www/public_html/vendor/craftcms/cms/src/console/Application.php(101): yii\console\Application->runAction('image-optimize/...', Array)
#20 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('image-optimize/...', Array)
#21 /storage/XXXX/www/public_html/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#22 /storage/XXXX/www/public_html/craft(22): yii\base\Application->run()
#23 {main}
khalwat commented 4 years ago

So these errors shouldn't be new... I didn't change anything that would cause them to start happening, but it's good to see them in the log.

What I'm looking for, though, is the logs similar to what you showed earlier, can you find lines like these?

2020-10-28 10:41:57 [-][1][-][info][nystudio107\imageoptimize\services\OptimizedImages::shouldCreateVariants] Array
(
)

2020-10-28 10:41:57 [-][1][-][info][nystudio107\imageoptimize\services\OptimizedImages::addVariantImageToModel] URL created: https://kalypso.com/images/splash/_300x168_crop_center-center_60_line/362262/DigitalTires.jpg

There should be additional lines.

I think at some point soon, we should screenshare to save time.

stevehurst commented 4 years ago

See below. This is from a different field/asset section, but it should also generate color palettes. I'm able to screenshare to help resolve this, I'll send you a note through your company info@ address and we can figure out a time.

2020-10-30 01:23:18 [-][-][-][info][nystudio107\imageoptimize\services\OptimizedImages::shouldCreateVariants] Array
(
)

2020-10-30 01:23:18 [-][-][-][info][craft\base\FlysystemVolume::deleteFile] File not found at path: _600x600_crop_center-center_82_line/Daniel-Rapcsak-Headshot.png
2020-10-30 01:23:18 [-][-][-][info][craft\base\FlysystemVolume::deleteFile] File not found at path: _1200x1200_crop_center-center_61_line/Daniel-Rapcsak-Headshot.png
2020-10-30 01:23:18 [-][-][-][info][craft\base\FlysystemVolume::deleteFile] File not found at path: _300x300_crop_center-center_82_line/Daniel-Rapcsak-Headshot.png
2020-10-30 01:23:18 [-][-][-][info][craft\base\FlysystemVolume::deleteFile] File not found at path: _600x600_crop_center-center_61_line/Daniel-Rapcsak-Headshot.png
2020-10-30 01:23:18 [-][-][-][info][craft\base\FlysystemVolume::deleteFile] File not found at path: _100x100_crop_center-center_82_line/Daniel-Rapcsak-Headshot.png
2020-10-30 01:23:18 [-][-][-][info][nystudio107\imageoptimize\services\OptimizedImages::addVariantImageToModel] URL created: https://kalypso.com/images/people/_100x100_crop_center-center_82_line/302013/Daniel-Rapcsak-Headshot.jpg
2020-10-30 01:23:18 [-][-][-][info][nystudio107\imageoptimize\services\OptimizedImages::addVariantImageToModel] Created transforms for variant: Array
(
    [width] => 100
    [useAspectRatio] => 1
    [aspectRatioX] => 1
    [aspectRatioY] => 1
    [retinaSizes] => Array
        (
            [0] => 1
            [1] => 2
        )

    [quality] => 82
    [format] => jpg
)

2020-10-30 01:23:18 [-][-][-][info][craft\base\FlysystemVolume::deleteFile] File not found at path: _200x200_crop_center-center_61_line/Daniel-Rapcsak-Headshot.png
2020-10-30 01:23:18 [-][-][-][info][nystudio107\imageoptimize\services\OptimizedImages::addVariantImageToModel] URL created: https://kalypso.com/images/people/_200x200_crop_center-center_61_line/302013/Daniel-Rapcsak-Headshot.jpg
2020-10-30 01:23:18 [-][-][-][info][nystudio107\imageoptimize\services\OptimizedImages::addVariantImageToModel] Created transforms for variant: Array
(
    [width] => 100
    [useAspectRatio] => 1
    [aspectRatioX] => 1
    [aspectRatioY] => 1
    [retinaSizes] => Array
        (
            [0] => 1
            [1] => 2
        )

    [quality] => 82
    [format] => jpg
)
khalwat commented 4 years ago

So Craft CMS is what ImageOptimize uses to do the transforms -- and it looks like it's saying the transforms don't exist.

Can you run Utilities -> Assets Index to re-index your assets, and double-check your asset volume settings?

Also is this happening for every image, or just some?

stevehurst commented 4 years ago

It's happening on all of our images, across several volumes and fields. We're using the following path settings format in our volumes config:

        'imagesSplash' => [
            'path' => '@webroot/images/splash',
            'url' => '@web/images/splash',
        ],

There aren't any issues with ImageOptimize generating the transforms. We've been using them for 2-3 years now. It's only the lightness and color palette settings that don't work.

I'm running a re-index on one of our volumes now to test. Do you want queue.log outputs from that?

stevehurst commented 4 years ago

Resolved with Andrew. Turning on 'Generate Placeholders' in Image Optimize settings or config fixes this problem.