Fix image error, group images
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
e9ea25ad38
commit
85e03a12dc
|
@ -76,15 +76,16 @@ class MainController extends Controller {
|
||||||
|
|
||||||
if (!empty($res)) {
|
if (!empty($res)) {
|
||||||
if ($images = data_get($res, 'images')) {
|
if ($images = data_get($res, 'images')) {
|
||||||
$images = array_filter($images, function($item) {
|
|
||||||
return !empty($item);
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach ($images as $key => $image) {
|
foreach ($images as $key => $image) {
|
||||||
|
if (empty($image)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$file = $this->downloadFile($image);
|
$file = $this->downloadFile($image);
|
||||||
|
|
||||||
$attachment = $book->attach($file, [
|
$attachment = $book->attach($file, [
|
||||||
'key' => $key
|
'key' => $key,
|
||||||
|
'group' => 'images'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$attachment->filename = $key . '.jpg';
|
$attachment->filename = $key . '.jpg';
|
||||||
|
|
Loading…
Reference in New Issue