本文整理匯總了PHP中CommonUtil::getImgBySize方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonUtil::getImgBySize方法的具體用法?PHP CommonUtil::getImgBySize怎麽用?PHP CommonUtil::getImgBySize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonUtil
的用法示例。
在下文中一共展示了CommonUtil::getImgBySize方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkImgAction
/**
* 圖片檢測接口
* img 圖片url
*/
public function checkImgAction()
{
//sleep(50);
$log = new FLogger("images_log");
$url = FRequest::getString('imgs');
$item = FRequest::getInt("type");
if (!$url) {
FResponse::output(array('status' => 'fail', 'msg' => 'parm img is empty'));
return;
}
if (!$item || $item <= 0) {
FResponse::output(array('status' => 'fail', 'msg' => 'parm type is empty'));
return;
}
$images = explode(",", $url);
if (!$images || count($images) <= 0) {
FResponse::output(array('status' => 'fail', 'msg' => 'the length of images is less than 0'));
return;
}
// 檢測圖片域名
foreach ($images as &$url) {
$S = parse_url($url);
$S = strtolower($S['host']);
//取域名部分
if ($item == Service_TupuTech::$SEXY_AND_AD && !(strpos($S, "yuanfenba.net") || strpos($S, "mumu123.cn"))) {
FResponse::output(array('status' => 'fail', 'msg' => 'the host of image is error'));
return;
}
if (strpos($S, "yuanfenba.net") || strpos($S, "mumu123.cn")) {
$url = CommonUtil::getImgBySize($url, 256);
}
}
$log->append("checkImgAction - begin :" . time() . json_encode($images));
$res = Service_TupuTech::doCheckImages($images, $item);
$log->append("checkImgAction - 1 :" . time());
if ($res["code"] == 0) {
$data = Service_Images::addImagesRecord($res, $item);
FResponse::output($data);
} else {
$log->append("[ERROR] checkImgAction is error" . json_encode($res));
FResponse::output(array('status' => 'fail', 'msg' => 'check img is error'));
}
$log->append("checkImgAction - end :" . time());
}