Website screen capture on Linux server - ruby-on-rails

I have a webpage written in AngularJS that needs to be turned into an image and sent as an email once a week to clients. The webpage is on S3 and my backend server is written partly in Rails and partly in Node. Any ideas how to do this?

You can use something like PhantomJS (or based on Phantom CasperJS) - this is library like Selenium, headless browser. Possible to create screenshots with different device resolution and User-Agent. http://phantomjs.org/screen-capture.html

Related

TinyMCE 5 images not showing to some users

I am using TinyMCE 5 on my ruby on rails app that runs on https. I have a Wordpress website running on http that hosts images.
After uploading an image to Wordpress, I copy its HTTP URL into tinyMCE image section and these work fine and displayed properly as well.
However, some users are complaining that they can't see images. Whenever I check it works fine. What could be the problem?
Possible reasons could be too many calls at the same time, usage of http for Wordpress site or slow network connection of the user.
This is most likely an issue with the host that you are using for storing images. (maybe there is a daily limit on number of requests that you can process)
Possible solution:
Store your images on AWS S3 or Google Drive etc and use their links in tinyMce. It will most definitely work.

What does Mandrill do with attachments in test mode?

I am porting a client's website away from using the servers sendmail to using Mandrill. Creating a test API key is great for testing the code/process on a dev version of the site, but is there a way I can test that the attachments are working within this test mode?
You can see your attachments in your API Logs (cover the last 100 API calls) in test mode
As far as I experienced last week, there's no option to preview an attachment in test mode. Actually I wasn't able to do it even with production keys which is quite surprising if I'm not missing something.
All I can see in the API logs is the email, but at least for me, there is no option to preview the attachment.

Can we manage the silent print always by PHP or Jquery

print.print_always_silent use to print the page without print dialog box. My question is, can we do this my PHP / JQUERY code?. Please Help me how know well abt this.
I hope not. That would mean any website could print any document from my printer when they want. Would be a huge security hole imho
This is certainly not possible through the browser with PHP, which runs on the server. It's also not possible with javascript: browser security ensures that. Imagine what might happen if any web site could print whenever it wanted to.
There are (or were) ActiveX controls available for IE that enabled this. It might be possible with a browser extension for Chrome or Firefox if you want to explore that.
One other possibility is setting up a printer on Google Cloud Print and having your PHP server print directly to that, bypassing the browser altogether. Handling the authentication behind such a scheme could be tricky, but the API is documented on Google's site.

iframe data on webpage inside of a UIwebView my domain won't load others will

So I published my app and I wish to upgrade it. My app is entirely local HTML5 inside a UIwebView. My webpages show images from local storage and from 3rd party domains and from my own domain. Works great. I also load 3rd party webpages using iframe works great. When I attempt to load a webpage from my own domain the page will not load in an iframe. Why not? It does not matter if I point to the DNS or IP of the page. Same thing, will not load.
When I installed my own web server I named it earthHappens.com. The configuration before this break was my domain was pointing to a host with an alias at Network Solutions 02da1a1.netsolhost.com. Now it is pointing to an IP. The failure began when earthHappens.com was pointing to earthHappens.com. I deleted this host name from my server and it now works like before.
Thanks for your help Alex, This caught me so off guard that I had a hard time slowing down my thoughts to realize what I had done to break it and my published app was broken so I was a little freaked:) send me an e-mail and I'll send you a promo-code. (iPhone) -Brad

taking a screenshot of user's current page in ruby on rails

this is fo debugging purpose, please take into account the following:
the user logs in to his/her account so manually fetching a url will not work - the screenshot must happen together when the user access his admin pages.
would love to receive guidelines specific for ruby on rails and heroku (i guess heroku is not much an issue i just dump the screenshot to s3).
so ideally like i mentioned in #1, when a user access a page, my app also takes a screenshot of the entire page and dumps it in a tmp folder.
can anyone point me how to handle that?
In order to get a screenshot of what the user is currently seeing, you have to have some code on the user's machine that uses the underlying operating system API to take the screenshot. The API calls involved are different for Windows, Mac OS X and Linux.
Ruby on Rails executes on the remote server and generates HTML and JavaScript etc. that is sent to the user's web browser. The HTML is rendered by the browser and the JavaScript executes within the browser's sandbox, where it has no direct access to the operating system API. The important point is that there is no direct interaction between the server-side code and the OS running on the user's computer. If this were possible then it would be a massive security hole.
Therefore it's not possible to do what you want programmatically unless you can first install a client-side program on the user's computer that can talk to your server-side code. It cannot be done using Ruby on Rails alone because it's a server-side web framework.
You can't do this without a user sending a screenshot themselves.

Resources