Jump to content

the field legend is required at least in English (English)


Recommended Posts

    private static function copyImg($id_entity, $id_image = NULL, $url, $entity = 'products')
   {
       $tmpfile = tempnam(_PS_TMP_IMG_DIR_, 'ps_import');

       switch($entity)
       {
           default:
           case 'products':
               $path = _PS_PROD_IMG_DIR_.intval($id_entity).'-'.intval($id_image);
           break;
           case 'categories':
               $path = _PS_CAT_IMG_DIR_.intval($id_entity);
           break;
       }

       if (@copy($url, $tmpfile))
       {
           imageResize($tmpfile, $path.'.jpg');
           $imagesTypes = ImageType::getImagesTypes($entity);
           foreach ($imagesTypes AS $k => $imageType)
               imageResize($tmpfile, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']);
       }
       else
       {
           unlink($tmpfile);
           return false;
       }
       return true;
   }    

Link to comment
Share on other sites

×
×
  • Create New...