How to recreate an image preview from outside websites? - ruby-on-rails

Similar to Facebook's UI, I am attempting at generating a preview image from an external linked website. So that when a user types in a url he is linking, the UI will by default, scan that site for an img and scrape a preview thumb.
Is there a specific name for this technique? Or can anyone point me in the direction of learning this?
Thanks so much!

Its called scraping. There is a library called scrAPI.
Here is a code example http://crunchlife.com/articles/2007/08/13/code-snippet-ruby-image-scraper

There are a couple different options when it comes to page scraping. Another one to check out would be nokogiri, http://nokogiri.org/. You can find tutorials on how to use it at http://nokogiri.org/tutorials.
Instead of grabbing an image from the site, why not grab the image of the entire page? You could make use of a free screenshot service like http://www.websnapr.com/ or http://www.thumbshots.com/ among others. In one application, I use that for my preview image, and use nokogiri to scrape the page title and description. Just an idea.

Related

How to implement an interactive PDF in iOS

Here im hitting my head againt the wall.
My client provided a pdf with buttons(just like buttons,when user tap on button,it will load next page and previous page etc.).
This buttons will work only when we open it in adobe reader.
I tried the QLpreviewview,quickview but it is not working,all what i can do is just to load the pdf in the webview.
Can anyone please help me in how to load an interactive pdf in iOS.
Thanks in advance.
Have a look at PSPDFKit, it is the most advanced framework I've found for PDFs in iOS. They have an impressive list of customers as well.
It is a bit pricy though, but you have the option to get the Source Code too if you need to modify anything. Could be worth it if your client need that kind of performance and other features as well.
(I am not in any way affiliated with PSPDFKit)
The limitations are due to the capabilities (or non-capabilities) of the PDF viewer used.
Currently the leading PDF viewer on iDevices is PDFExpert by Readdle. Adobe Reader for iDevices is weaker, but can deal to some extent with form elements.
For page navigation etc. you might use links instead of button fields (as far as you can live with the capabilities of links, and not use JavaScript). Links are said to be handled properly with many PDF viewers.
You may have to require certain PDF viewers on instructional level, because you don't have control over the viewer used by the actual user. And, as you noticed, many PDF viewers are simply too dumb do deal with active elements.
Another approach would be looking at PDF-to-HTML5 converters, and serve HTML5 from a server.

Stop part of page being index by search engines?

How can I stop search engines indexing part of my page? Is there an HTML5 element for this?
Its just a line of text that I want to hide (a co-worker doesnt want their name on google for some reason). Im thinking that I could inject the text with javascript, but I have heard google does sometimes look inside javascript files.
I also thought of using images instead of text, but im concerned how this will look cross device and platform. Ive noted text rendering can differ on mac and pc and thats before ive had to think about mobile devices, retina displays, etc.
Thanks
You can't hide content unless you use the methods you've already outlined above. Your best bet is to use JavaScript in an external file and then block that file using robots.txt.

User customizable backgrounds in Rails 3 App

We are looking to implement User customizable backgrounds in our Rails 3 App. We want to add this facet to the settings page, and from there allow users to upload a JPEG or whatever image file extension it may be, and then make sure it is tiled to fit each Browser window.
How should we go about implementing something like this?
If including code from our repo would assist in gathering a solution, definitely let me know.
Thank you all for your valuable time.
You can make a get request from javascript for a rails resource that is said image and add this as the background-image() for the body. To get the non-public image, this should be useful: https://stackoverflow.com/a/8313398/1040358. To modify the css, this should be useful: https://stackoverflow.com/a/253710/1040358. Good luck! :)

Click on Print gives a screen shot to save in rails3

I may fall under the list of possible duplicates but still i could not find the answer according to my req.In my rails application i have some web pages with a link of print option.
Now what i need is when i click on this print ,i should get a screen shot of the current web page and a popup box to save the image .Is there any plugin available for the same.
Also any queries for code are welcome
Thanx
You could go for phantomJs. Where you can alter the page HTML, manipulate CSS, insert & call javascript snippets, the way you need it.
Good documentation available and also you can find great deal of help in stackoverflow-phantomjs
Regards,
HBK
May i suggest that you use http://www.w3.org/TR/css-print/
if you want to make a screeenshot you have to work with the user env, so i suggest you look at this topic How do I take screenshots of web pages using ruby and a unix server?

Issues with Filemaker IWP working with hyperlinks on images

I have a filemaker database that I need to be able to link records and all associated data (including container field data) to various points placed on a large PDF image, and then make that data appear via instant web publishing when someone clicks on the marker for that area on the PDF. For example the PDF may be an image of a car, and then I would have various close up images of issues with the car and descriptions of those images as records in the database. I would then want to drop points on the base PDF image and when you clicked on those points be able to see the close up images and other data related to those images.
I'm being told this is too much for IWP because:
I need to place the markers outside filemaker via PDF annotation
Filemaker IWP can't handle the number of markers that may be necessary (it could be up to 1,000 on an E sized image.
Does anyone have a work around or explanation why this is a problem?
If I understand correctly, you would like to setup a PDF with links that will open a browser and show data related to what was clicked. Assuming that is the case, the reason this wont work is because IWP does not provide a unique URL for a unique page. For example, here on StackOverflow you can directly link to any question based on its URL:
http://stackoverflow.com/questions/3207775/ -- this question
http://stackoverflow.com/questions/4973921/ -- some other question
IWP uses Javascript and session variables to manipulate the output to the screen, so there is no way to link to a specific section of your IWP site, since the URL is always something like:
http://yoursite.com/fmi/iwp/cgi?-db=YOUR_DB-loadframes -- Product A
http://yoursite.com/fmi/iwp/cgi?-db=YOUR_DB-loadframes -- Product B
http://yoursite.com/fmi/iwp/cgi?-db=YOUR_DB-loadframes -- Product C
Because of the limited nature of IWP, you will not be able to workaround this issue. You'll need to build your own web-interface using the Custom Web Publishing Engine, either using the built-in PHP extensions or some other technology where you invoke the XML publishing API.
I agree with Nate
IWP is the wrong solution to this problem. You'd be better off simply hosting those images on a webserver.
Now here comes the plug, you can use SuperContainer to really simplify the management of the images from FileMaker.

Resources