1 void showBOMItemImage(ItemId _ItemId, ConfigId _ConfigId) 2 { 3 Image CacheImage; 4 container CacheContainer; 5 real ImageRatio; 6 int AdjustHW; 7 FilePath filePath; 8 BinData BinData; 9 InventStdPic m_InventStdPic; 10 11 #WINAPI 12 ; 13 14 AdjustHW = 50; 15 16 try 17 { 18 select firstonly m_InventStdPic 19 where m_InventStdPic.ItemId == _ItemId && 20 m_InventStdPic.ConfigId == _ConfigId; 21 22 if (m_InventStdPic && m_InventStdPic.PicsName && m_InventStdPic.ImageSize) 23 { 24 CacheContainer = m_InventStdPic.Images; 25 CacheImage = new Image(); 26 CacheImage.setData(CacheContainer); 27 28 if (CacheImage.height() > AdjustHW || CacheImage.width() > AdjustHW) 29 { 30 if (CacheImage.height() > CacheImage.width()) 31 ImageRatio = AdjustHW / CacheImage.height(); 32 else 33 ImageRatio = AdjustHW / CacheImage.width(); 34 } 35 36 ItemImage.width(CacheImage.width() * ImageRatio, Units::mm); 37 ItemImage.height(CacheImage.height() * ImageRatio, Units::mm); 38 39 BinData = new BinData(); 40 BinData.setData(CacheContainer); 41 42 filePath = WinAPI::getFolderPath(#CSIDL_INTERNET_CACHE); 43 filePath = m_InventstdPic.Filename(filePath); 44 45 BinData.saveFile(filePath); 46 47 ItemImage.imageName(filePath); 48 } 49 } 50 catch (Exception::Warning) 51 { 52 error(StrFmt("@SYS19312", CacheContainer)); 53 } 54 55 }