Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Is null Less Than a Positive Integer

images php coding issues or problems here.

Moderators: macek, egami, gesf

Is null Less Than a Positive Integer

Postby mikeh0001 » Tue Sep 11, 2012 5:59 pm

Hi,

I'm working with the code below which comes out of a wordpress function. I'm just learning php and I'm trying to figure out some of the code. On line 2 and 3, $new_w and $new_h are set to be the lowest value passed into the min() function. Then there are a couple of "if" statements which test for "!$new_w" and "!$new_h". Now in order for !$new_w or !$new_h to to TRUE, $new_w or $new_h has to be FALSE. But they will only be false if they hold a value of 0 or null. So does anyone get what lines 4 and 5 are trying to test for, and what they are trying to do if a condition is TRUE?


Thanks, Mike



function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = false) {

if ($orig_w <= 0 || $orig_h <= 0)
return false;

if ($dest_w <= 0 && $dest_h <= 0)
return false;


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);}


}
mikeh0001
New php-forum User
New php-forum User
 
Posts: 4
Joined: Tue Sep 11, 2012 5:26 pm

Re: Is null Less Than a Positive Integer

Postby seandisanti » 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.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 681
Joined: Mon Oct 01, 2012 12:32 pm

outnet herve leger cheapest Herve Leger on sale (2

Postby galloway8 » Wed May 15, 2013 7:27 pm

Customized software can have a great impact on your business; no matter if your business is small or big. For instance, some desktop products such as MailJet will send personalized mails to a clients list, and software product such as RSS Feed Creator helps create, edit and publish feeds and podcasts, herve leger dresses for sale Network Sniffer software will help you view IP packets over a network and a System Purifier will act like a file shredder and junk file finder. All of these desktop products will make any webmasters life so much easier.
Then there are several server software products such as Jitbit Helpdesk and AspNetForum that are offered these days which are quite helpful for a webmaster.
What is hosted help-desk software?
Quite contrary to the downloadable helpdesk software version, hosted help-desk software need not be downloaded, installed and run. If you are not a tech-savvy it is better to have max azria herve leger a hosted help-desk instead of the downloadable version. The software runs on the developer company?s servers and it is the developers who monitor the [url=/]herve leger cheap dress[/url] software and fix bugs.
How does hosted help-desk software work?
A client will take a name and logs in to the hosted help-desk software. He submits trouble tickets which are handled by the technicians afterwards. The web server and the entire database are maintained by the developer company.
Which is better a download version of help-desk or a hosted version of help desk software?
In the downloadable version of help-desk software, you need to do everything: download, install and run. It no doubt has met with success. But should you have issues with your servers, it might just be that herve leger sample sale you rent [url=/]herve leger dresses[/url] can as well try the hosted help-desk service. But make sure the company has problem free servers and provides 24x7 monitoring.
Issue tracking also becomes easier through a hosted version as compared to a downloadable help-desk version. Because as the company maintains the database with every problem fixed, the software ticket system will close the issue and the same will get published in the knowledge portal. Additionally, hosted help-desk software generates reports with the [url=/]bcbg herve leger dress[/url] option of even exporting it to your excel. All implying that issue tracking becomes less cumbersome and more qualitative.
Additionally, user?s e-mail messages will be translated into support tickets through the software and it will notify both the hosted company?s customer support as well as the user. This makes issue tracking easier, less time consuming while also reducing the operational costs for the user.
What next?
Do some due diligence. Do not compromise on your requirements; choose the hosted help-desk software that matches your needs. Read through the real customer reviews of the hosted help-desk software users. Get your doubts cleared and talk to companies that offer the service and check for prices. But more importantly check the customer support they offer and see if the price and package fits your requirements.

Related articles:


herve leger bandage dresses cheapest Herve Leger o

herve leger shop cheapest Herve Leger on sale (1)

herve leger strapless dress cheapest Herve Leger on sale (26)
galloway8
New php-forum User
New php-forum User
 
Posts: 200
Joined: Mon Jan 07, 2013 3:36 am


Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.