Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
validate_image_info.php
Go to the documentation of this file.
1 <?php
8 
10 $filesystem = $objectManager->get(\Magento\Framework\Filesystem::class);
11 
13 $config = $objectManager->get(\Magento\Catalog\Model\Product\Media\Config::class);
14 
16 $tmpDirectory = $filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA);
17 $tmpDirectory->create($config->getBaseTmpMediaPath());
18 
19 $targetTmpFilePath = $tmpDirectory->getAbsolutePath($config->getBaseTmpMediaPath() . '/magento_small_image.jpg');
20 copy(__DIR__ . '/magento_small_image.jpg', $targetTmpFilePath);
21 // Copying the image to target dir is not necessary because during product save, it will be moved there from tmp dir
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
$objectManager
$targetTmpFilePath