Commit 6ffa00d3 authored by hujun's avatar hujun

压缩图片

parent d23c7620
...@@ -446,6 +446,7 @@ Route::group('task', [ ...@@ -446,6 +446,7 @@ Route::group('task', [
'updateShopTask' => [ 'task/JobTask/updateShopTask', [ 'method' => 'post | get' ] ], //默认跟进 'updateShopTask' => [ 'task/JobTask/updateShopTask', [ 'method' => 'post | get' ] ], //默认跟进
'updateShopImageIdTask' => [ 'task/JobTask/updateShopImageIdTask', [ 'method' => 'post | get' ] ], //默认图片 'updateShopImageIdTask' => [ 'task/JobTask/updateShopImageIdTask', [ 'method' => 'post | get' ] ], //默认图片
'image' => [ 'task/JobTask/image', [ 'method' => 'post | get' ] ], //压缩图片
'updateShopAddress' => [ 'task/JobTask/updateShopAddress', [ 'method' => 'get' ] ], //默认图片 'updateShopAddress' => [ 'task/JobTask/updateShopAddress', [ 'method' => 'get' ] ], //默认图片
'push' => [ 'task/PushMessageTask/push', [ 'method' => 'get' ] ] //推送 'push' => [ 'task/PushMessageTask/push', [ 'method' => 'get' ] ] //推送
......
...@@ -4,6 +4,8 @@ namespace app\task\controller; ...@@ -4,6 +4,8 @@ namespace app\task\controller;
use app\index\service\ImageDepotService; use app\index\service\ImageDepotService;
use app\model\GHouses; use app\model\GHouses;
use app\model\GImageDepot;
use think\Image;
/** /**
* Created by PhpStorm. * Created by PhpStorm.
...@@ -106,4 +108,18 @@ class JobTask ...@@ -106,4 +108,18 @@ class JobTask
$this->gHouseModel->updateHouse($houseArr); $this->gHouseModel->updateHouse($houseArr);
} }
} }
/**
* 压缩图片
*/
public function image() {
set_time_limit(0); // 取消脚本运行时间的超时上限
$depot = new GImageDepot();
$image_data = $depot->getImageDepotList('img_name', [], 1, 500);
$path = './static/shop_image_depot/';
foreach ($image_data as $k=>$v) {
$image = \think\Image::open($path.$v['img_name']);
$image->thumb(960, 960)->save($path.$v['img_name']);
}
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment