edit-down_img_size
This commit is contained in:
+20
-12
@@ -37,12 +37,15 @@ class Img extends CI_Controller
|
||||
require_once COMMPATH.'/third_party/TCPDF/tcpdf.php';
|
||||
$brand_id = $this->input->get('brand_id');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 5;
|
||||
$params = [
|
||||
'status_pid' => 0,
|
||||
'status' => 1,
|
||||
'brand_id' => $brand_id,
|
||||
'page' => $page
|
||||
'page' => $page,
|
||||
'size' => $size
|
||||
];
|
||||
$result = $this->ordersv2list->lists($params['status_pid'], $params);
|
||||
$lists = $result['lists'];
|
||||
@@ -55,6 +58,21 @@ class Img extends CI_Controller
|
||||
$contract = $this->order_contracts_model->select(['o_id'=>$val['o_id'],"imgs <> ''"],'','','','id,o_id,file,imgs,type');
|
||||
if($contract){
|
||||
foreach ($contract as $v) {
|
||||
$path = FCPATH."pdf/{$row['sid']}";
|
||||
if (!file_exists($path)) {
|
||||
$oldumask = umask(0);
|
||||
mkdir($path, 0777, true);
|
||||
umask($oldumask);
|
||||
}
|
||||
if($val['o_id']>=10000){
|
||||
$file_name = $type_arr[$v['type']] ? $type_arr[$v['type']].'.pdf' : '其它_'.time().'.pdf';
|
||||
}else{
|
||||
$file_name = $old_type_arr[$v['type']] ? $old_type_arr[$v['type']].'.pdf' : '其它_'.time().'.pdf';
|
||||
}
|
||||
if(file_exists($path.'/'.$file_name)){
|
||||
echo "合同id:{$v['id']},已生成<br>";
|
||||
continue;
|
||||
}
|
||||
$imgs = json_decode($v['imgs'],true);
|
||||
if(is_array($imgs)){
|
||||
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT,true, 'UTF-8', false);
|
||||
@@ -81,17 +99,7 @@ class Img extends CI_Controller
|
||||
$pdf->Ln();
|
||||
$pdf->Image('@'.$res, '', '', '', '', '', $img_url,'' , false, 300, '', false, false, 0.05, false, false, false);
|
||||
}
|
||||
$path = FCPATH."pdf/{$row['sid']}";
|
||||
if (!file_exists($path)) {
|
||||
$oldumask = umask(0);
|
||||
mkdir($path, 0777, true);
|
||||
umask($oldumask);
|
||||
}
|
||||
if($val['o_id']>=10000){
|
||||
$file_name = $type_arr[$v['type']] ? $type_arr[$v['type']].'.pdf' : '其它_'.time().'.pdf';
|
||||
}else{
|
||||
$file_name = $old_type_arr[$v['type']] ? $old_type_arr[$v['type']].'.pdf' : '其它_'.time().'.pdf';
|
||||
}
|
||||
|
||||
$pdf->Output( $path.'/'.$file_name,'F');
|
||||
echo "合同id:{$v['id']},保存成功{$path}/{$file_name}<br>";
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user