How to render uploaded photos with NodeJS and Express? - image

I generally post examples of my best shot at what I'm asking about, but in this case, I have no idea where to start (haven't uploaded photos before in other languages).
So how does one go about rendering uploaded photos. I'm using Node v0.4.2, Express 1.0.8, and Mongoose 1.0.16 and have uploading of images working (they end up in ~/tmp right now).
Thanks.

If you just want to render thumbnail versions of your uploaded images for display, try using the imagemagick wrapper node-imagemagick.
For example, you could store your hires-images in a data-folder on your server (lets say /data/images) and render thumbnail images into a web-accessible folder (on upload).
I do not recommend generating the thumbnails on the fly, as it can massively increase your server's load when a large image (especially vector formats like eps or pdf) is being rendered.
For imagemagick examples, consider reading up the docs for the convert command.

Related

How to make a "lock" on image that when downloaded will corrupt it?

With intellectual property becoming a harder and harder area to protect with copyright, one particular area I have been thinking a lot about is images like .jps and .png
I was wondering if there is any way to make a mini "bomb" per se that when an image is uploaded to a website, nothing happens, it's perfectly fine and stays there but when downloaded by someone other than the original uploader, the .jpg or .png corrupts itself and cannot be viewed.
I have tried to research the topic but all I am able to find is how to's on how to fix corrupted images or files.
TL;DR
When an image file is downloaded from the host website the image corrupts itself from being viewed.

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

How do I flatten/compress a pdf which is generated with prawn?

I am using prawn to generate pdf files which have lots of images so they come out quite large. I can open the file in Adobe Acrobat and then save it using the "reduce file size" option, and a 164MB file shrunk to 7MB and retained all of the image quality. I would like to replicate this compression in Ruby. I have tried using the compression settings which prawn offers and they have not had any effect on the file size. I suspect there must be a way to do it with RMagick, but I haven't figured it out yet.
I apologize for not including any code samples showing what I have tried, but I removed the prawn compression settings when they didn't have any effect, so I don't have anything to show.
Have you tried simply making a copy of the PDF with RMagick? That is, read in the PDF and write it back out again.
Also, check with the ImageMagick folks at https://www.imagemagick.org/discourse-server/. Any advice they offer you can be implemented via RMagick.

Extract images from .swf viewer?

I'm wondering how it possible to extract images from .swf viewer?
Note that .swf file have not images itself.
For example I'm trying extract images from AVON catalogue from this link - http://avon.com.ua/PRSuite/eBrochure.page?index=1&cmpgnYrNr=201404&pageNo=0
Any ideas?
Best way is to put the .swf file in a decompiler for image extraction. Decompilers are smart enough to extract images for you and arrange them.
JPEXS Free Flash Decompiler is a more popular one
http://www.free-decompiler.com/flash/
You can extract other useful content from it as well.
Just download the .swf file from the website
A while back (like around 1999) I wrote a set of tools for Flash animations.
One of the tools is swf_dump which can be used to extract objects (i.e. write the objects in a form of script that sswf can nearly recompile...)
The tool also allows for extracting images that are inline (not downloaded dynamically by the flash animation, if so, anyway, you could as well download those images manually, you'd need the URL, though.)
The command line you can use is:
swf_dump -d my-animation.swf
Then your current folder will be littered with all the images that were found in the flash file. It extracts JPEGs and PNGs. The source can be compressed (SWF or CWF are supported.)
Now, you're on your own to compile that thing... The project is here and is in great need of updating (but Flash is kind of going out too...)
https://sourceforge.net/projects/sswf/

Drupal image upload issues

When uploading images in Drupal I have continuously encounter an issue with the physical size of the image - not the size of the file.
Let me explain further. An image could be a small file size (under the restrictions) but be larger than average on the screen. These images fail to upload in Drupal across all sites that I have built using the CMS.
Has this happened for anyone else? Any ideas how I could get around this?
I tend to use filefield and imagefield rather than the image module, because I think they give better flexibility.
You could also try imagecache, which gives you a lot of control over the uploaded images

Resources