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

Docs update: API $config->imageSizerOptions missing key "sharpening" #409

Closed
esszett opened this issue Oct 19, 2017 · 7 comments
Closed

Comments

@esszett
Copy link

esszett commented Oct 19, 2017

Setting imageSizerOptions in config.php as written in the API-docs is generating a PHP Notice: "Undefined index: sharpening in .../www/wire/core/Pageimage.php:512"

Expected behavior

Docs should mention key "sharpening"

Optional: Suggestion for a possible fix

Add "sharpening" and possible values "soft, …" to API docs

Setup/Environment

  • ProcessWire version: 3.0.62
  • PHP version: 7.0
@Toutouwai
Copy link

You don't say exactly how you are setting the imageSizerOptions in /site/config.php, but be aware that for config settings that are arrays (as imageSizerOptions is) you must merge your settings with the default settings.

So for instance you cannot do this:

$config->imageSizerOptions['upscaling'] = false;

But must instead do:

$config->imageSizerOptions = array_merge($config->imageSizerOptions, ['upscaling' => false]);

@esszett
Copy link
Author

esszett commented Oct 19, 2017

I guess it's my mistake: I did in config.php

$config->imageSizerOptions = array(
 'upscaling' => false,
 'cropping' => false,
 'quality' => 90
);

Thank you for pointing towards array_merge() – I did miss that.

@esszett esszett closed this as completed Oct 19, 2017
@Toutouwai
Copy link

Toutouwai commented Oct 19, 2017

Thank you for pointing towards array_merge() – I did miss that.

I don't think it's documented anywhere - it's just what I've found from personal experience. You would think you would be able to set individual array values by key but for some reason it doesn't work.

@Toutouwai
Copy link

And you are right in that if the API docs are going to state the defaults then they should be the complete defaults. I think you should reopen this issue so the API docs get updated.

@esszett esszett reopened this Oct 23, 2017
@ryancramerdesign
Copy link
Member

You can also do this for any array property when you just want to set one part of it: $config->imageSizerOptions('upscaling', false);

@ryancramerdesign
Copy link
Member

There are now just too many imageSizerOptions to fit within the phpdoc in that class, so I've updated the note to say "see /wire/config.php for all options and defaults".

@netcarver
Copy link
Collaborator

@esszett Hello there. Could you close this issue if it is resolved to your satisfaction, otherwise post a reply so we know to keep it open and on the radar. Thank you!

@esszett esszett closed this as completed Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants