Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
Added assets container to config
Browse files Browse the repository at this point in the history
  • Loading branch information
jezzdk committed Sep 24, 2021
1 parent 7a4b3d8 commit 7019f2e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ By the time you read this there might be others. Consult [the documentation](htt

### A note regarding images

Only the featured image will be downloaded. Multiple featured images, images added with ACF and other plugins, are not downloaded. Featured images will be downloaded to the "assets" container into a folder called "{collection_handle}/{entry_slug}", and saved on a field on the entry called "featured_image".
Only the featured image will be downloaded. Multiple featured images, images added with ACF and other plugins, are not downloaded. Featured images will be downloaded to the "assets" container by default, into a folder called "{collection_handle}/{entry_slug}", and saved on a field on the entry called "featured_image".

You can use the events above to do your own downloading of images and what not. I have done this myself with great success 👍

Expand Down Expand Up @@ -79,6 +79,11 @@ return [
*/
'download_images' => true,
/**
* The name of the assets container where images should be downloaded.
*/
'assets_container' => 'assets',
/*
* Whether to skip download of an image if it already exist. The default is 'false'.
*/
Expand Down
5 changes: 5 additions & 0 deletions config/statamic-wp-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
*/
'download_images' => true,

/**
* The name of the assets container where images should be downloaded.
*/
'assets_container' => 'assets',

/*
* Whether to skip download of an image if it already exist. The default is 'false'.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private function downloadAsset(string $url = null, string $collection, string $s

Storage::put($tempFile = 'temp', $image);

$assetContainer = AssetContainer::findByHandle('assets');
$assetContainer = AssetContainer::findByHandle(config('statamic-wp-import.assets_container'));

$asset = $assetContainer->makeAsset("{$collection}/{$slug}/{$originalImageName}");

Expand Down

0 comments on commit 7019f2e

Please sign in to comment.