// -------------------------------------------------------------------------------- // bool guDbCache::SetImage( const wxString &url, wxImage * img, const wxBitmapType imgtype ) { wxImage TmpImg( * img ); // int Width = 150; // int Height = 150; // int ImageSize = guDBCACHE_TYPE_IMAGE_SIZE_BIG; // TmpImg.Rescale( Width, Height, wxIMAGE_QUALITY_HIGH ); guImageResize( &TmpImg, 150 ); if( !DoSetImage( url, &TmpImg, imgtype, guDBCACHE_TYPE_IMAGE_SIZE_BIG ) ) return false; TmpImg = * img; // Width = 100; // Height = 100; // ImageSize = guDBCACHE_TYPE_IMAGE_SIZE_MID; // TmpImg.Rescale( Width, Height, wxIMAGE_QUALITY_HIGH ); guImageResize( &TmpImg, 100 ); if( !DoSetImage( url, &TmpImg, imgtype, guDBCACHE_TYPE_IMAGE_SIZE_MID ) ) return false; TmpImg = * img; // Width = 50; // Height = 50; // ImageSize = guDBCACHE_TYPE_IMAGE_SIZE_TINY; // TmpImg.Rescale( Width, Height, wxIMAGE_QUALITY_HIGH ); guImageResize( &TmpImg, 50 ); if( !DoSetImage( url, &TmpImg, imgtype, guDBCACHE_TYPE_IMAGE_SIZE_TINY ) ) return false; // delete the expired entries but call it only 5% of the times if( guRandom( 1000 ) < 20 ) ClearExpired(); return true; }
// -------------------------------------------------------------------------------- // bool DownloadImage( const wxString &source, const wxString &target, const wxBitmapType imagetype, int maxwidth, int maxheight ) { bool RetVal = false; wxBitmapType ImageType; wxImage * Image = guGetRemoteImage( source, ImageType ); if( Image ) { if( maxwidth != -1 ) { guImageResize( Image, maxwidth, ( maxheight != -1 ) ? maxheight : maxwidth ); } RetVal = Image->SaveFile( target, imagetype ); delete Image; } return RetVal; }