I'm creating a site that allows users to upload images from their mobile phones, through their browser. Before adding this feature to my site, I'm testing it out with a rails scaffold. To accomplish image upload, I'm using Paperclip 4.1. Image uploading is working flawlessly on my laptop, but it isn't working on my Android. When I click "Choose file" on my droid, I am able to select an image from my galley (among many other options), but when I click "Update" I get two errors:
Avatar content type is invalid
Avatar is invalid
The content type is a jpg, which I know is valid because I can upload jpgs on my laptop. I don't understand what the other error means. Here is the validation I'm using (got it from paperclip's quick start guide on GitHub):
validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/
Is this a flaw of paperclip, or am I doing something wrong? Please let me know if you need more of my code.
I ended up using CarrierWave instead, which was able to handle image uploads through mobile and desktop.
Related
I have the below tag in my website for downloading image
<a href="data:image/png;base64,%20iVBOdfd...." download="myimage.png" />
The above tag is working normally, when it is pressed, it will download the image without any issue.
When I tried this function on ios / android, the web browser will download the image to some "Download" folder instead of writing it to camera roll (IOS) / DCIM (android).
My question is, is it possible to write to camera roll or DCIM? If it is possible, how can I achieve it? This function is crucial to my application as my users always find it hard to navigate on phone to retrieve the downloaded images at later time.
P.S: My concern is more about the writing destination, filesystem access on phone, not the download itself.
P.S: this is a normal website written using html, vuejs. not native, not react native, not vue-native.
Thank you.
That is not possible since it is the web browser who has access to the device and your web application cannot decide where to save the image. You'll need to implement an app to achieve the expected result. Also study Progressive Web Apps to see whether it's possible
We have a file server on which we place PDF documents and then embed links to them in a smart device app. Up until recently, using links to the PDF documents starting with http:// worked fine for Android and iPhone users. All could load the PDF file just fine. Then a few months back (approximately) Android phone users started reporting they would get an error when trying to load any PDF. Yet iPhone users had no issues loading the same PDF document. It was verified that these PDF documents (several) were not corrupted and opened fine when placed on another file server.
I have an iPhone so I can't give you the exact error msg received by Android users but to reproduce it, it was along the lines of... click the link to the PDF, a button appears showing View PDF, click that button and several apps appear to choose the app to open the PDF with, click one (like Adobe Reader, or Google Drive) and an error appears stating the file could not be opened and may be corrupted of the wrong syntax.
Tonight I found the solution.
The url to the PDF on all these documents on our server had been like http://...
but when I changed it to https://... it works fine.
I can't find ANYWHERE any mention of a change by Google that this is now a requirement.
My question...
Can someone explain and/or point me to a reference that explains why https must be used in embedded links to PDF documents? It seems like a pretty big deal to make this a requirement and not tell anyone. My searching the internet has so far not turned up anything.
Can't find any direct reference to the problem online. I've created an Azure function to create thumbnails using the cognitive services tool (following the guide at https://www.hackster.io/achindra/azure-function-apps-running-custom-code-on-blob-insertion-d71aba and only modifying it to use the EASTUS location instead of projectoxford). All works find and dandy, but I have found that whilst all thumbnails come back marked application/octet-stream (all originals are image/jpeg), only those that were taken on any of: DSLR, Windows Phone, iOS device are usable and work both as images on a website or in photos app on the computer. However all photos taken with an Android phone (well, all the ones I have tested so far!) come back with a file format that is not supported. They are .jpg, and have content type of application/octet-stream as do the other thumbnails. Any bright ideas gratefully received.
The Microsoft Cognitive Vision APIs do not accept images larger than 4MB. It will return a InvalidImageSize error when you do.
The general advice is to downscale the image on the client before posting it to the API if your images are larger.
I'd like to generate a signed link via S3 and then allow a mobile user to download this file. So far this is going okay (downloads with the correct name, filesize, etc).
However - when it comes to opening it (even a .png), I get the message "Cannot open file" and it doesn't turn up in the device's photos, gallery, or anything like that.
Are there some kind of headers missing? Some extra bit of set-up?
The context is a React Native app where the user requests a file, opens the URL via Linking in Chrome, Chrome downloads it, and then they can open it properly. Ideally this will work for any file types (e.g. png, jpg, docx, pdf). Thanks!
If you can't do this in ReactNative, you can always leverage on a native picker. https://developer.android.com/guide/topics/providers/document-provider in any case, there are tons of information to open files in ReactNative with some extensions as: https://github.com/huangzuizui/react-native-file-opener. I tried a couple of them and they work. It should do the job, check the permissions in your application as well. It can be a headers problem so you need to check all of this.
I am developing an application to display all the images in android's built-in gallery in to a php page. I posted the uri (content://media/extrenal/images/media) of the gallery images to the php page. I was not able to recreate images by using webView's function loadUrl().
Should I need to upload the whole gallery to another directory and display the images?
Or passing the bitmap itself will do?
Please suggest me an idea to solve the problem.
I think you should make an ashynchronous connection of your application with an php application on the server, which will tell the android app to upload the requested image, and when the java app receives the upload command, make the app upload the picture to the server, and make the server php app display the image uploaded. I know this is a bit complicated, but this is the only thing that is comparatively easier than doing socket transports and other things. Good luck :)