private function importImage(ProductImage $image, $path) { if (!$path) { return false; } if (@parse_url($path, PHP_URL_SCHEME)) { $fetch = new NetworkFetch($path); $path = $fetch->fetch() ? $fetch->getTmpFile() : ''; } else { if (!file_exists($path)) { foreach (array('/tmp/import/', ClassLoader::getRealPath('public.import.')) as $loc) { $p = $loc . $path; if (file_exists($p)) { $path = $p; break; } } } if (!file_exists($path)) { $path = ''; } } if ($path) { $man = new ImageManipulator($path); if ($man->isValidImage()) { $image->save(); $image->resizeImage($man); $image->save(); } } }