Hi All,
In my current application there is a custom retrieval of assets is written which forms the generateURL while deploying to DB and WebServer.
The issue is it has only JPEG anf File formats. But now we need PNG assets to be retrieved.
I wanted to replicate the custom retrieval for JPEG to PNG as well but not able to find the API docs for reference.
can I use the retrieveAsPNG(..,..,.) similar to retrieveAsJPEG()??
Im not so good at MB customizations, so asking for some help here.
Posting the same code for JPEG and FILE formats.
Version - 8.1.0
Thanks,
Lohit
-------------------------------------
public static String RetrieveJpeg(String assetID, int revisionNumber, String outputDir, int height, int width, boolean controlpropotions, MediaBinServerSoap mMediaBinServer)
throws Exception
{
String str = "";
int ht = height;
int wd = width;
System.out.println("Image Retrival");
if (mMediaBinServer == null) {
throw new Exception("You have not connected to a MediaBin Web Service");
}
if (assetID == null) {
throw new Exception("No asset was specified");
}
System.out.println("Starting image retrieval");
ByteArrayHolder byteArray = new ByteArrayHolder();
StringHolder tagID = new StringHolder();
StringHolder jobID = new StringHolder();
System.out.println(" Job ID " + jobID);
System.out.println("Asset ID " + assetID);
System.out.println("revision Number " + revisionNumber);
mMediaBinServer.retrieveAsJPEG(assetID, revisionNumber, width, height, controlpropotions, false, byteArray, tagID, jobID);
System.out.println("Image retrieval successful");
byte[] buffer = byteArray.value;
if (buffer != null)
{
String name = mMediaBinServer.getAsset(assetID).getMName();
File file = new File(outputDir);
file.mkdir();
file = new File(outputDir, name);
FileOutputStream fileStrm = new FileOutputStream(file);
fileStrm.write(buffer);
fileStrm.close();
}
System.out.println("Mediabin connection: get the job");
MBJob job = mMediaBinServer.getJob(jobID.value);
System.out.println("Job found " + job);
str = ParseMBJob(job);
System.out.println("Parsing the job " + str);
return str;
}
---------------------------------------