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

Image updated #1050

Merged
merged 10 commits into from
Aug 10, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use phalcon_get_intval
  • Loading branch information
dreamsxin committed Aug 10, 2013
commit 3f34a9c02f6212dbe3a4d11c32118c9be240f577
4 changes: 2 additions & 2 deletions ext/image/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,9 @@ PHP_METHOD(Phalcon_Image_Adapter, sharpen){
convert_to_long(amount);
}

if (Z_LVAL_P(amount) > 100) {
if (phalcon_get_intval(amount) > 100) {
ZVAL_LONG(amount, 100);
} else if (Z_LVAL_P(amount) < 1) {
} else if (phalcon_get_intval(amount) < 1) {
ZVAL_LONG(amount, 1);
}

Expand Down
7 changes: 6 additions & 1 deletion ext/image/adapter/gd.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,12 @@ PHP_METHOD(Phalcon_Image_Adapter_GD, _sharpen) {
phalcon_read_property_this(&image, this_ptr, SL("_image"), PH_NOISY_CC);

a = phalcon_get_intval(amount);

if (a > 100) {
a = 100;
} else if (a < 1) {
a = 1;
}
b = a;

b = -18 + (a * 0.08);
Expand Down Expand Up @@ -612,7 +618,6 @@ PHP_METHOD(Phalcon_Image_Adapter_GD, _sharpen) {
phalcon_call_func_p4(ret, "imageconvolution", image, matrix, tmp_amount, tmp);

if (zend_is_true(ret)) {
phalcon_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC);

PHALCON_INIT_NVAR(width);
phalcon_call_func_p1(width, "imagesx", image);
Expand Down
2 changes: 1 addition & 1 deletion ext/image/adapter/imagick.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, _sharpen) {
PHALCON_OBS_VAR(type);
phalcon_read_property_this(&type, this_ptr, SL("_type"), PH_NOISY_CC);

int_amount = Z_LVAL_P(amount);
int_amount = phalcon_get_intval(amount);

int_amount = (int_amount < 5) ? 5 : int_amount;
num = (int_amount * 3.0) / 100;
Expand Down