The `$mode` parameter of `imagecropauto()` defaults to `-1`. However,
`-1` is changed to `GD_CROP_DEFAULT` right away, so basically the
default is `GD_CROP_DEFAULT`, which is rather confusing and
unnecessary.
Therefore, we change the default to `IMG_CROP_DEFAULT`, but still allow
an explicit `-1` to be passed for BC reasons, in which case we trigger
a deprecation notice, so we can rid the `-1` support eventually.
pkg-config). (Eli Schwartz)
. The bundled libgd behaves now like system libgd wrt. IMG_CROP_DEFAULT never
falling back to IMG_CROP_SIDES.
+ . The default $mode parameter of imagecropauto() has been changed to
+ IMG_CROP_DEFAULT; passing -1 is now deprecated.
- Hash:
. The hash extension is now an integral part of PHP and cannot be disabled
that of system libgd:
* IMG_CROP_DEFAULT is no longer falling back to IMG_CROP_SIDES
* Threshold-cropping now uses the algorithm of system libgd
+ . The default $mode parameter of imagecropauto() has been changed to
+ IMG_CROP_DEFAULT; passing -1 is now deprecated.
- Hash:
. The hash extension cannot be disabled anymore and is always an integral
}
/* }}} */
-/* {{{ proto resource imagecropauto(resource im [, int mode [, float threshold [, int color]]])
+/* {{{ proto resource imagecropauto(resource im [, int mode = GD_CROP_DEFAULT [, float threshold [, int color]]])
Crop an image automatically using one of the available modes. */
PHP_FUNCTION(imagecropauto)
{
zval *IM;
- zend_long mode = -1;
+ zend_long mode = GD_CROP_DEFAULT;
zend_long color = -1;
double threshold = 0.5f;
gdImagePtr im;
switch (mode) {
case -1:
+ php_error_docref(NULL, E_DEPRECATED, "Crop mode -1 is deprecated. Use IMG_CROP_DEFAULT instead.");
mode = GD_CROP_DEFAULT;
+ /* FALLTHRU */
case GD_CROP_DEFAULT:
case GD_CROP_TRANSPARENT:
case GD_CROP_BLACK: