sequence = currentNote.getResources().size();
newRes = createResource(path,sequence ,"image/gif", false);
QImage pix = new QImage();
pix.loadFromData(image);
newRes.setHeight(new Integer(pix.height()).shortValue());
newRes.setWidth(new Integer(pix.width()).shortValue());
logger.log(logger.EXTREME, "Renaming temporary file to " +newRes.getGuid()+".gif");
path = Global.getFileManager().getResDirPath(newRes.getGuid()+".gif");
tfile.rename(path);
} else {
newRes = conn.getNoteTable().noteResourceTable.getNoteResource(latexGuid, false);