correct helper picbook

This commit is contained in:
Name
2021-06-16 16:05:30 +03:00
parent 98d9351efe
commit fe4db1b3e0
2 changed files with 14 additions and 2 deletions

View File

@@ -21,7 +21,9 @@ function bookid_kuri($slug) {
if (isset($book['price_id'])){ if (isset($book['price_id'])){
$book['pic'] = IMGSRV."price/300x470/{$book['price_id']}.{$book['priceimg']}"; //$book['pic'] = IMGSRV."price/300x470/{$book['price_id']}.{$book['priceimg']}";
$book['pic'] = picbook($book, 300, 470);
$book['links']['pdf'] = SITE.'read/'.$book['pricehash']; $book['links']['pdf'] = SITE.'read/'.$book['pricehash'];
$book['links']['text'] = SITE.'readtext/'.$book['pricehash']; $book['links']['text'] = SITE.'readtext/'.$book['pricehash'];
$file = PDFSOURCE.$book['price_id'].'.pdf'; $file = PDFSOURCE.$book['price_id'].'.pdf';

View File

@@ -5,6 +5,16 @@
function picbook($item, $width, $height) { function picbook($item, $width, $height) {
return IMGSRV.'price/'.$width.'x'.$height.'/'.$item['price_id'].'.'.$item['priceimg']; $id = $item['price_id'];
$img = $item['priceimg'];
if (in_array($img, array('jpg', 'jpeg', 'gif', 'png', 'JPG'))){
$fileimg = $id . '.' . $img;
}
else
$fileimg = $img;
return IMGSRV.'price/'.$width.'x'.$height.'/'.$fileimg;
} }