Is null Less Than a Positive Integer

images php coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Tue Oct 02, 2012 11:39 am

Code tags help readability.

Code: Select all


if ( $crop ) {

1. $aspect_ratio = $orig_w / $orig_h;

2. $new_w = min($dest_w, $orig_w);
3. $new_h = min($dest_h, $orig_h);

4. if ( !$new_w ) {$new_w = intval($new_h * $aspect_ratio);}

5. if ( !$new_h ) {$new_h = intval($new_w / $aspect_ratio);}


}
lines 2 and 3 determine new width and height based on original or destination size.

lines 4 and 5 look at new_w and new_h (since you're probably only specifying a new width or a new height) and assign the corresponding value for the whichever is not set.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest