Finding the file size of an image file in the Sony Camera Remote API - camera

I'm writing a fairly involved application for working with Sony cameras.
I can list the contents of the camera and copy image files no problem at all, but I can't seem to figure out the size of the files before I start to download them.
I'm receiving the file list using the standard getContentList API, and finding the files using the originals array in the response. That response seems to have no file size information in it.
Is this possible? Knowing the file size before downloading is important for a good user experience, and all the other camera APIs support it.
I do get the size when I start to download in the HTTP Content-Length header, but performing HEAD requests to hundreds of URLs in a row seems very inefficient!

Unfortunately the API does not support getting the file size.

Related

Resize image downloads for IPFS assets in CloudFlare

I am writing a Swift iOS app that uses Blockfrost.io to download assets from the Cardano blockchain. The asset's images come in the format ipfs://QmSJPFVN..., which can be retrieved by using the URI in a CloudFlare URL, like this https://cloudflare-ipfs.com/ipfs/QmSJPFVN....
My issue is that most of the images I'm trying to fetch and display are enormous, and it's seriously slowing down my UI. Are there parameters that can be added to the URL to specify a smaller image size to be fetched? I've looked around for a solution but haven't been able to find any.
You have two options for this -
Use a 'proxy' to fetch the image server-side and convert before downloading. Could make use of a Cloudflare worker for instance - https://developers.cloudflare.com/images/image-resizing/resize-with-workers
Download the full size image, but convert it within your app before displaying it in the UI. You'll still use full amount of bandwidth in this approach, but may reduce complexity.

Telegram API, uploading images to get a FileID in VB.NET

I recently started building a little bot in VB.NET and got pretty far with it. Though, there are quite some things I'm simply not getting far with.
One of these things is uploading an image.
I use the Telegram API as a DLL which is pretty nice so far.
Though, I struggle with uploading pictures.
The code itself is Telegram.bot.SendPhoto.sendFromFile_id(chat_id, <fileID goes here>).
it is pretty much self explanatory, though I have no idea how I can obtain a fileID. The API itself does not explain how to do it, and I'm not that good in reading other codes from other languages and translate them over into the language I'm using at this moment.
Is there any kind of solution for this I could try to use?
Telegram API Document description about FileID ( Source:Telegram Bot API ) :
There are three ways to send files (photos, stickers, audio, media, etc.):
If the file is already stored somewhere on the Telegram servers, you don't need to reupload it: each file object has a file_id field, simply pass this file_id as a parameter instead of uploading. There are no limits for files sent this way.
Provide Telegram with an HTTP URL for the file to be sent. Telegram will download and send the file. 5 MB max size for photos and 20 MB max for other types of content.
Post the file using multipart/form-data in the usual way that files are uploaded via the browser. 10 MB max size for photos, 50 MB for other files.
I have same problem and solve this way :
1.first upload image to cloud and get image url
2.set URL file_ID
C# Code example :
String ID = bot.chat_id;
bot.SendPhoto.sendFromFile_id(ID, "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png");

Download chunks of MP4 file from iOS

I am developing an iOS app that synchronises with GoPro cameras.
One of the feature requires downloading MP4 from the GoPro (potentially huge).
I basically have a url like: http://10.9.9.5/whatever/video.mp4.
However, I only need parts of the video, let's say between 1:00 and 1:05.
I am thinking on downloading just parts of the MP4, using HTTP "Range" header. I believe that it's possible and I will get a bunch of bytes.
However, is it a valid file? Will I be able to create a MP4 ? Do I need the MP4 header with meta information? Do any of you faced this kind of challenge?
I am using Objective C but I believe that this is a general question.
The MP4 file is a container for video that is structured around something called boxes. Probably you'll have h.264 video in that MP4 file, knowing that, you'll need to know the structure of the file you are trying to chunk.
Depending on the way it is encoded you'll have to look for a box with metadata that'll allow you to search for the correct part of the file either at the beginning or at the end, but you'll have to reconstruct a valid MP4 with the data you get from the original file.
You can see a reference of the file format here http://xhelmboyx.tripod.com/formats/mp4-layout.txt.

OneDrive - Wrong size for PNG files

When uploading certain PNG files the size is incorrectly reported on the OneDrive website and in the Photo object returned by the REST API. This can be reproduced using the following PNG file:
http://www2.zippyshare.com/v/11270772/file.html
The file size is 20.3 KB, OneDrive displays it as 38.4 KB
It seems this only happens with PNG files that would be downsized/converted when the downsize_photo_uploads query param is absent or set to true. But the problem is not just limited to uploads using the REST API.
The problem has been already been reported here.
Ryan from OneDrive here. We looked into this and have a good understanding of what's going wrong with the size. OneDrive computes the "space" a file takes up in our system by using the size of the largest data stream associated with a file. When an image is uploaded to OneDrive, we also create thumbnails for images so that we can quickly show various views in our clients and website.
In the case of this particular file, one of the JPG thumbnails we create for the PNG file is actually larger than the original file (due to the JPG compression not being as effective as PNG for this image). As a result, the thumbnail is actually the largest stream on the file. As you can imagine, that doesn't happen very often, but for this image (and others like it) we have this bug.
We have a bug tracking the issue and are investigating how we can fix the API to return the size of the "default" stream -- the stream that represents the actual contents of the file. I don't have an ETA for the fix, but we're working on it.
FWIW, I appreciate your post, I discovered that is seems to be the same issue with the Android Onedrive SDK post I made a couple weeks ago
Does OneDrive change/re-encode jpg files?
It doesn't seem like anyone from MS is actually monitoring these SO tags very closely, so I'm creating a Github issue on the Android SDK, maybe that will produce an answer.
https://github.com/liveservices/LiveSDK-for-Android/issues/37

Upload large file on server is this possible by create firefox addon

I want to upload large video file. for that i want to create firefox addon. Is this possible by create firefox addons to upload large files on my server.
or is there any other way to upload large files on server.
please suggest.
If you are POSTing the data to the server as application/x-www-form-urlencoded then you should base64 encode it using btoa() and include it as one of the POST parameters in the request body (i.e. the string passed to XMLHttpRequest.send()):
postbody = "body=" + btoa(fileContents);
xhr.send(postbody);
If you are just downloading the file and uploading it right away, you might as well keep it in memory since you're presumably going to load it into memory anyway in order to base64 encode the contents.
Well if you're reading the file into memory then you should need an nsIFile at all. You can just download it using XMLHttpRequest and use responseText, uploading it in the way I described in the answer. If you do have an nsIFile then yes, that snippet describes how to read from it.
I assume you are wanting to upload via HTTP.
If so, the upload limit is usually decided by the server-side software. This affects both the maximum size and the length of time you have to upload it.
Without a server capable of taking an upload in chunks and reassembling it, you are limited in ways you can't get around through software.
If you want to upload via FTP on the other hand, there are a lot of options... look at FireFTP.
I have made firefox addons for fileupload.
I integrate jquery file upload.
I create widget. In the widget I made panel. In panel I create separate web page for file uploading. And panel is calling that page.
For more information you can mail me at chetansinghal1988#gmail.com