<?php
namespace blog\controller;
use blog\lib\Web;
class Image extends Web
{ private $zips = [
'40x30',
'160x90'
];
public function zipimgApi()
{
$data = $this->request->get();
if (empty($data['img']) || empty($data['w']) || empty($data['h']) || !file_exists($data['img'])) {
return $this->header->setCode('404');
}
if (!in_array($data['w'] . 'x' . $data['h'], $this->zips)) {
return $this->header->setCode('404');
} else {
$dst = $this->imgzip->resize($data['img'], $data['w'], $data['h']);
return $this->header->rediret('http://localhost/imgs/' . $dst);
}
}
}