function custom_number($num, $sep = ',') { $i = 0; $post_decimal = substr_after($num, '.', false, true); $num = substr_before($num, '.'); $num = (string) $num; $strlen = strlen($num) - 1; for ($n = $strlen; $n > -1; $n--) { $string = ($i > 0 and $i % 3 == 0) ? $num[$n] . $sep . $string : $num[$n] . $string; $i++; } if (!empty($post_decimal)) { $string .= '.' . $post_decimal; } return $string; }
function image_crop($p, &$error) { $image = new oneImage($p['image'], $p['thumb']); $p['file'] = substr_before($p['thumb'], '.'); $result = $image->crop($p); if (empty($result)) { $error = $image->error; } return $result; }