Can't stream tiff image using cfcontent - image

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.

Related

How to open image file using pdftron

I want to load an image file using the pdftron webviewer api.
For pdf files it's working fine but I want to load image files and add annotations to them.
In the user guide there is no information regarding working with images.
Yes, WebViewer can do this out of the box.
There are a number of image formats supported. Here is the breakdown.
PNG, JPEG
Simply pass the image URL to WebViewer initialDoc constructor parameter, or to WebViewer.loadDocument().
If your URL does not have a proper file extension, then you can do the following.
myWebViewer.loadDocument("mydomain/generic_url_to_image", {filename: "input.png"})
This works with both PDFNetJS Lean and Full editions.
TIFF, GIF, BMP
You can utilize the browser's HTML5 canvas to load the images, and then generate PNG/JPG from the HTML5 canvas, and then pass the follow the instructions above.
JP2 or multiple images in one document.
Using PDFNetJS Full edition, which does not come with the standard WebViewer download, you have full control over PDF creation.
PDFNetJS Full Download: http://pdftron.com/downloads/PDFNetJS.zip
Using PDFNetJS Full you would follow the AddImage sample code to construct a PDF with the image(s) in it.
http://pdftron.com/webviewer/pdfnetjs/config.html#file=samples/PDFNet/AddImageTest/AddImageTest.js

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)

file stored on s3 not rendering in browser

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.

Wordpress Theme (JVPress) Header Graphic Won't Display in Internet Explorer 8

I have a Wordpress site (www.nurseresumetips.com) and I'm using a theme named JVPress.
This theme lets you to upload a custom header graphic. If you open the page in Firefox the header graphic displays, however when I open it in Internet Explorer 8 the image is not found.
The link that Wordpress is generating is: http://www.nurseresumetips.com/wp-content/uploads/20110419033853_nrt.jpg
This link works in Firefox but not in Internet Explorer.
I just want to know if anyone could point me in the right direction.
Thanks
Having looked around, I think you may be tripping over a problem like this, where your JPEG is encoded in a slightly odd format. Looks like CMYK is accepted as a format by some browsers, but not others.
Depending on your software, you might be able to find a way of saving in a more usual colour encoding -- in Photoshop, for example, try the specific "save for web" option.
Given the content of your image, I'd actually suggest saving the file as a PNG, anyway. JPEG is best for photographic images; for textual images like this one, PNG will probably (a) be more efficient, (b) look better -- no encoding artefacts around the nice solid lines you have, and (c) not have this odd problem you're facing.

Why are images not showing up with Carbon's HTML rendering library

I have an old program that shows an embedded browser using the HTML Rendering library from Carbon. I am migrating it from codewarrior to Xcode, using the 10.4 SDK. While the HTML is displayed correctly, including links, the images just don't show up. I can see the alt content, and dimensions are properly set with the width and height fields.
I am doing the initialization with:
OSErr err = HRNewReference(m_HRRef, kHRRendererHTML32Type,
GetWindowPort((WindowRef) m_pWindow));
And then I open my local HTML file with:
err = HRGoToFSRef(m_HRRef, &f, false, false);
My images are also stored locally but just do not appear, it was working fine previously on my ppc-only codewarrior compilation.
I tried with web pages on Internet with HRGoToURL, and I tried replacing my pictures src fields with http:// or file:// links to images, in jpg, gif and png, always with the same result.
Are you aware of any issue like this? I know I could, and probably should, migrate to WebKit but that would me more involved.
Sylvain
This is a shot in the dark (I am completely unfamiliar with HTMLRenderingLib), but it reminds me of this. Maybe here too it doesn't load images, even local ones, asynchronously; have you tried letting the run loop loop (whichever way is most appropriate to your app: WaitNextEvent, return back to the main runloop, spin a sub event loop, …) and see if the images load?

Resources