No, 'px' is not the issue.
$post['avwidth'] is NOT a number, It is the exact same value as
$this->post['avwidth']. It is a "string" and therefore it is always greater than the string value 180 you are testing against.
There are several ways to extract just the number from that string, one way is with the "substr" function:
http://php.net/manual/en/function.substr.php
Look at the last example in example 2:
PHP Code:
$rest = substr("abcdef", -3, -1); // returns "de"
So try something like this:
PHP Code:
$avwidth = substr($post['avwidth'], -7, -1 ); //returns just the numerical width
if(intval($avwidth) > 180)
{
$this->post['avwidth'] = 'width="180"';
}