Commit 12cc178f by liumengfei

优化ins缓存脚本文件路径

parent e4845811
......@@ -40,7 +40,6 @@ class InstagramFeedPull extends Command
const IMAGE_PATH = '/joshine/instagram/';
const IMAGE_TMP_PATH = '/joshine/instagram/tmp/';
const BASE_PATH = "/www/wwwroot/www.joshine.vip/pub/";
/**
* @var Csv
*/
......@@ -239,6 +238,9 @@ class InstagramFeedPull extends Command
OutputInterface $output
)
{
$base_path = str_replace( '\\' , '/' , realpath(dirname(__FILE__).'/../../../../../../'));
$base_path .= "/pub/";
$this->id = $this->getId();
$storeId = $input->getOption('store_id');
if (!$storeId) {
......@@ -251,12 +253,14 @@ class InstagramFeedPull extends Command
return;
}
$media = $raw['data'];
foreach ($media as $index => $row) {
$url = $row["thumbnail_url"] ?? $row["media_url"];
$key = isset($row['thumbnail_url']) ? 'thumbnail_url' : 'media_url';
$res = $this->downloadImage($url);
$path = $this->resize($res);
$res = str_replace(self::BASE_PATH,"", $path);
$res = str_replace($base_path,"", $path);
$media[$index][$key] = $res;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment