MetadataExtractor File format could not be determined - exif

I'm using metadataExtractor (v.2.7.1) in .Net Core (3.0.1) to get the date of the photos.
var file = Request.Form.Files[0];
try
{
IEnumerable<MetadataExtractor.Directory> directories = ImageMetadataReader.ReadMetadata(file.OpenReadStream());
....
}
And I get sometimes this exception on this line "File format could not be determined"
Any idea what is wrong? This photo seems to be correct and having the exif metadata I need.
The code is working for other photos.
Thank you in advance

The problem was that this photo was larger than the other one and was uploaded in chunck. I was trying to get EXIF from each chunk, which is not possible...

Related

Not able to download Suitelet through suitescript 1.0

I have created a button to export the form data to simple Excel.
Everything is working file, even if i try to save this excel file in the file cabinet it gets saved correctly.
But when i try to downlaod the excel file, downloads wierd single cell file with special characters or system gives either an error or saves an empty excel file.
Can anyone help me in how to download the excel file from button click. I think i have issue in my responce.
My Code example is as follows:
.
.
.
xmlString += '</Table></Worksheet></Workbook>';// this is my xml string
var xlsFile = nlapiCreateFile('test.xls', 'EXCEL', nlapiEncrypt(xmlString, 'base64'));
response.writeFile(xmlFile);
}
error screenshot:
I think the reason for the response issue is because you are calling a non-existent variable "xmlFile" in writeFile();
try using this writeFile(xlsFile);

Google Drive File Stream files creation date

I know it has been asked a few times already, but - not in this context I think and other questions have been asked few years ago already, so I'm hoping maybe something changed.
So my issue is - I am uploading files to the Google Drive using Google Drive File Stream. However, while the uploading goes smoothly, I have a problem with files creation date - it is always changed to the timestamp of the time the file got uploaded, not the actual, local file creation date. It is a serious problem, as I am going to use this to back-up huge amounts of data and preserve all the meta-data I can and the creation date is crucial. Is there a way to either upload it with the creation date intact, or to change it after the upload? From what I've seen this seems not to be possible, but I have to try and make it work. Any help and insight will be appreciated. I'm using the Drive File Stream with Python.
EDIT: I didn't make it clear enough - the issue here is that I don't want to use Google Drive API at all, but rather deal with this using only Google Drive File Stream interface if it's possible.
create
If you check the documentation for files.create You will find that acceptable metadata for file creation does include a createdTime
You should then just add this to the metadata you use when uploading the file. As you did not post your code I have grabbed the standard example from the documentation and added the created time as follows.
file_metadata = {'name': 'photo.jpg', 'createdTime': 'THETIME'}
media = MediaFileUpload('files/photo.jpg', mimetype='image/jpeg')
file = drive_service.files().create(body=file_metadata,
media_body=media,
fields='id').execute()
print 'File ID: %s' % file.get('id')
Update
In the event that you want to update the ones you have already created you could use the following method.
If you check the documentation for file create you will find that the response is just a File resource
If you check file resource you will see that CreatedTime is write able.
You should run a file.update and reset the createdTime to the proper time.

How can i make 'text' to 'downloadable url'?

I make chrome extension, which download some files from website.
i want write some log with txt file, because my program has some error and i want save error to txt file.
but i can't find how to do it.
someone say it's impossible.
i try to search, some questions say just 'app' can do it, but extension can't.
if i want this functions, i must change my program to web app? but i don't know anything about that...
'download file' is possible, download is write file to filesystem.
i think, 'write text file' is so easy work then download image and sound files....
why not??? what's diffrent??
i see many questions, blog and document, but i cant know clearly.
*to sum up
I want make some text to downloadable file. If i can get downloadable file and it's url, everything is perfect.
i see this extension, i think i can do it. but i don't know how to do it.
please teach me how do it!
https://chrome.google.com/webstore/detail/save-text-to-file/mkepenkbhepjelljcfiooignmpfgochi/related
This is what I understand from your question that you want to write some text into .txt file and it should be automatically downloaded for your users. For that, here I am writing code in JavaScript which will surely helps you.
var fileText = "Your content which you want to save in file";
var fileBlob = new Blob([fileText], {
type: 'text/plain'
});
var fileUrl = URL.createObjectURL(fileBlob);
var fileName = 'mytextfile.txt';
var fileOptions = {
filename: fileName,
url: fileUrl,
conflictAction: 'uniquify'
};
fileOptions.saveAs = true;
It will automatically download mytextfile.txt file with your given contents. You can implement this logic in your chrome extension as per your way.

Can't get to exif data .JPG image

I'm trying to read the exif data from a .JPG image. I've tried differents solutions found here and there (PIL, piexif, exifread...) and none of them worked for this set of images. It worked for other images taken from another camera but not for this one, all these different methods returning empty dictionaries. It seems that there is no exif data but (I apologies for my newbyness) when I RIGHT-click + properties (I use windows), I do see what is exif data to me : date of creation, etc...
Here is one image :
image.JPG
If another of the thousands of anonymous heroes could help me on this one, I would be very grateful...
Alright so I found a solution which I share now.
The problem is that the libraries that open metadata are not taking all possible configurations for the image file and therefore, they can handle some and some others they cannot. I finally made it using exiftool, an executable that I dowloaded on my windows on this link :
https://sno.phy.queensu.ca/~phil/exiftool/
Then I paste the executable in a folder and I add exiftool.py in that folder, that I got from :
https://github.com/smarnach/pyexiftool/find/master
Then, using this small piece of code (for example):
import exiftool
with exiftool.ExifTool("exiftool.exe") as et:
metadata = et.get_metadata_batch(files)
for d in metadata:
print("{:20.20} {:20.20}".format(d["SourceFile"],
d["File:FileCreateDate"]))
Of course, this is just to show that you indeed can access the metadata, then you can do whatever you want with that. Here is the documentation of the library exiftool : http://smarnach.github.io/pyexiftool/
Cheers, JM

Wrong fonts and wrong autofit when using Syncfusion's ExcelToPdfConverter

I am currently using Syncfusion's ExcelToPdfConverter to convert an XLSX document to a PDF.
I first create the XLSX document and then convert it to PDF with the following code:
var converter = new ExcelToPdfConverter(workbook);
//Intialize the PDFDocument
var pdfDoc = new PdfDocument();
//Intialize the ExcelToPdfconverterSettings
var settings = new ExcelToPdfConverterSettings();
//Assign the PDFDocument to the TemplateDocument property of ExcelToPdfConverterSettings
settings.TemplateDocument = pdfDoc;
settings.EmbedFonts = true;
//Convert Excel Document into PDF document
pdfDoc = converter.Convert(settings);
//Save the pdf file
pdfDoc.Save(PDFFullPath);
The resulting XLSX is correct and it looks like it should.
The converted PDF isn't correct though. It's just like it's using wrong fonts and, as a consequence, those rows that have been autofitted with AutofitRow get truncated.
Has anyone else had this issue before?
Is there any way to tell the PDFConverter to use the correct fonts? (Please note that I'm using Arial and Calibri and they're both installed in the system's fonts)
Regards.
We suspect that the issue might occur due to the assignment of wrong row index. In XlsIO, the Row and Column indexes are one based.
Kindly refer below documentation to know more about AutofitRow and AutofitColumn.
Documentation Link: https://help.syncfusion.com/file-formats/xlsio/worksheet-rows-and-columns-manipulation#auto-fit-a-single-row-or-column
Regards,
Abirami.
This was actually a bug in Syncfusion XlsIO that has been fixed in a patch due out in February 2017.
The above code is correct.

Resources