file stored on s3 not rendering in browser - ruby

I am copying an image that I extract from an .ipa file on s3. The file is getting move correctly but when every I try to view it in a browsers it appear to broken, in google chrome. If I download the file directly to my machine and open it appears perfectly fine. It also renders ok in Safari.
Dir.mktmpdir do |dir|
Zip::File.open(tmp_ipa) do |zip_file|
# Find Icon File
icon = zip_file.find do |entry|
entry.name.include? 'AppIcon76x76#2'
end
icon.extract(File.join(dir, 'AppIcon.png'))
s3_icon = bucket.objects[icon_dest]
s3_icon.write(Pathname.new(File.join(dir, 'AppIcon.png')))
icon_url = s3_icon.public_url.to_s
end
end

The most likely problem is that you didn't set the Content-Type to image/png when you uploaded your image to S3. Try this on the command line:
curl -i http://your-bucket.s3.amazonaws.com/path/to/AppIcon.png
What's the Content-Type header? If it isn't image/png, set that at the time you upload.

This is almost certainly because Apple uses a non-standard proprietary extension of the PNG file format for the PNG files in an iPhone APP (archived link), such as the .ipa you say it was extracted from.
The reason it works in Safari, is because Safari uses the OS's image decoding libraries, which do support this non-standard format.
There are some conversion scripts out there, that work with varying success.

Related

After I datamined apk files the png images. I tried to open it. I get error message saying that it doesn't support this file format

Well, my question as it says in title. I managed to get all apk assets but every png file doesn't open.
What is more interesting that when I check file extension in the google of the image it says this.
File Type: data
MIME Type: application/octet-stream;
Suggested file extension(s): bin lha lzh exe class so dll img iso
Anyone have any guess how to make every png file work ?

Image not rendering properly

I'm attempting to parse an image that is possibly corrupt and it's driving me nuts trying to figure out what's wrong. Here is what I've deduced..
Example image: https://s3.amazonaws.com/edison_new/ffb3ccc402d6bd6-original
The images only show up in Chrome
Can't drag them to the desktop (on a mac).
Attempting to save them to computer yields a file that is "damaged or could not be open" when opening with Preview
Attempting to open in Photoshop yields "Could not complete your request because an unknown or invalid JPEG marker type is found."
Files are stored on Amazon S3
The meta data indicates the content-type to be image/jpeg
File definitely exists as you can see it in Chrome...
Anyone can help me deduce what is going on here??
The image is in WEBP format, its not natively supported in IE or FF so will not be displayed.
http://caniuse.com/#feat=webp
(I opened it in IrfanView to see what format it was)

Why pdftk produced pdf files will not render in Firefox?

I have a site - www.jcrocetta.com.
On this site I have 2 pdf files. One file has blurred data and the other is clear, both files were created with pdftk.
In order to blur out some personal data in the pdf I used Inkscape. But Inkscape only opens/edits one PDF page at a time. After I made my edits in Inkscape I saved the files as .pdf formatted files. At that point I had three separate pdf files, pages 1 through 3. I then used pdftk to concatenate the 3 files into one.
The final pdftk-produced files are on www.jcrocetta.com. Just click the public information button.
In Chrome viewing inline works fine.
Downloading the file from Firefox works fine too.
But viewing inline on Firefox it renders blank pages. How can I fix this?
Also, I know that pdf files not produced with pdftk will render correctly on both Chrome and Firefox.
Thanks for your help.
FireFox has a lovely new feature: It now uses the PDF.js library to render PDF files, instead of calling out to an Adobe Reader plugin, or forcing you to save the file to disk. Unfortunately, it seem that PDF.js isn't quite perfect yet. A quick search shows that other people have the same issue, but the only "solution" I've seen offered boils down to "file a bug report at https://github.com/mozilla/pdf.js/issues or https://bugzilla.mozilla.org/enter_bug.cgi?product=Firefox&component=PDF+Viewer".
Also: Do the three individual PDF files render in FireFox, before you use pdftk to concatenate them?

broken image in chrome and firefox works in safari

I have a logo that shows up in Safari but in Chrome it appears as a broken link and simply does not show up at all in Firefox.
<img src="images/logo-01.png"/>
I have re-uploaded it many times and have even tried alternative paths and file names.
anyone know how i might be screwing this up?
I ran into this same problem. For me, it turns out the image was corrupt. If i tried to open the png file up in photoshop, i would get an error saying it could not parse the file.
For whatever reason, safari could display the corrupt file, but chrome could not. This is how i fixed my issue. I noticed "preview" on my macbook could open the file fine. If you are using windows, possibly try paint or gimp or some other program besides photoshop.
I downloaded the corrupt file onto my macbook, opened it with preview (open with > preview)
In the preview app, go to file > duplicate, which makes a copy of your image
Save that duplicated image
As a test, i tried opening that new copied image in photoshop and i was able to!
Upload new file to website. I was able to view the image in chrome now.
Hope that helps anyone who ran into the same problem.
It could be an issue with your file structure. Right now your links are using relative paths (e.g. href="index.html"). This is fine if the file you're referencing is in the same directory as the current page file. But if your current page is located elsewhere, like in a 'pages' directory or something, then you need to tell the links to start from the site root. That would look like href="/index.html" (note the slash). So for the image, you'd have:
<img src="/images/logo-01.png"/>

Can't stream tiff image using cfcontent

We're using cfcontent to stream images from outside the web root. jpegs, pngs, and gifs all stream correctly, but I can't get any tiff files to stream. I get the broken image icon, even though I can see that the file is in the correct location and the file name is stored correctly and is being passed correctly.
The code is really simple - the displaying page has
<img src="?file=common/includes/displayPhoto.cfm&thisImage=someImage.tiff" />
and displayPhoto.cfm has
<cfcontent type = "image/*" file = "#imagePath#" deleteFile = "No">
where #imagePath# has the fully qualified file path.
I'm at a loss - and my friend Google has let me down.
You're probably doing it right. The problem is that most browsers do not support TIFF. The only browser that does (and not all TIFF formats, at that!) is Safari.
On Firefox, Internet Explorer, Google Chrome, Opera etc, you will always see the broken image icon - because to the browser that image is indeed "broken", unintelligible.
See also Display TIFF image in all web browser
Your URL is wrong actually: You have something.cfm&x=y. In URL's, you begin with a question mark: something.cfm?x=y.

Resources