PHP: get frame from SWF to JPEG or GIF - php

How get frame from animate SWF to JPEG(or better animate GIF), using PHP. Possible using ffmpeg? Thanks.

This is not really possible without using a Windows box to open the file and capture a screenshot of the file. If you can convert the .swf to .flv then you can use ffmpeg to pull a frame, but if it is something like a game, well yea you are sort of out of luck unless you can setup (or are on) a Windows box.
I will try and find my code I used for windows to capture a screenshot, which worked in Windows 7 and XP and post it here, will have to wait till later as I do not have access to my backup files right now.
You might also take a look at this thread: Website screenshots using PHP

Related

Extract image from PDF using PHP

I already used pdfimages and it's working but when i tried to upload it on hosting, it's not working because exec, shell_exec, passthru and system function is disable. I can't enable it because it can hack my website.
I found a library called nusoap. I can extract image but it will only extract when images have effects like shadow, glow, reflection, etc.
Can anyone help me to find a library or code PHP to extract image from PDF? I start doing it one month ago and I'm still not finish on it. Sadlife.

FFmpeg/avconv rotate video with watermark adding using PHP-FFmpeg

I've got problem with rotating video and adding watermark during the same request. My system can get video from mobile devices and has to reformat it for HTML5. so I'm making mp4,webm and ogv formats. Everything works fine, I've figured out how to get video rotation using Mediainfo. I have only one problem. When I want add watermark and rotation to video during the same request I've got only video with watermark (in proper resolution and format) but without rotation. I've read that it is possible to achieve using complex-filter. Has anyone expirience how to make it possible using PHP-ffmpeg? It is very simple to use library, and works for me so it would be really cool if it will start to work.
Ok I've found the solution working well with PHP-ffmpeg wrapper. The solution was building from sources ffmpeg according to manual which is available on ffmpeg website. After this operation everything is working like a charm :)

PDF Thumbnailer

I am scratching my head with this one, how can you get a screenshot or a thumbnail of a PDF? I am developing a social feed on a web server I have no control over, there is a PDF class but I cant narrow down what it is, and theres no function in there for this task.
To do this serverside, you could use ImageMagick. This allows PDF's to be converted into images on the server, not having to depend on the client's browser to have certain software.
You do need to be able to install ImageMagick on the server though.
A link to a guide can be found here
You can use google docs
https://docs.google.com/viewer?a=bi&pagenumber=1&url=http://url-of-your-pdf.pdf
It returns a png of the first page, you can then edit it using Imagemagick or similiar
Idea from: How to create thumbnails/screenshots out of PDF files on my Linux server?

Pdf on web page: best solution

I need to include pdf files in some webpages, and I'm gettin' in troubles.
The app is a simple newspaper's archive, in which i can read right on page or download as pdf files, one file per page. What my customer can provide me is one pdf file for each page; what my customer wants from me is to navigate them in indexes (with page thumbnail) and have a read from a choosen one direcly in page; I'm using php/mysql.
I started trying out to use the <object> tag with type="application/pdf", but i found it's deprecate 'cause it's not crossplatform at all (there's no support on linux's browsers, but even my windows' firefox 3.5 couldn't show me anything).
I guessed I could transform that pdf in something different (html or simply images are good enough), but the only thing i found is ImageMagick, that I cannot use as I must install on server and I can't, as I'm not admin of that machine.
So, I'm finally looking for suggestions
Thanks
Display the pdf inline using an IFRAME. The thumbnail you can generate with imageMagik. You should be able to use the command line version of ImageMagik to resize and convert to jpg.
edit
Your best bet is to talk to the server admin and have them install php support for ImageMagik then you can use it as a class.
If you can't get support to install on the server, you will have to use the command line version.
You might be able to Google around for a library that wraps the command line, but it would be trivial to write it yourself.
With this in place you can create a large readable black and white png for each page. It should click through to the pdf.

How can I generate a screenshot of a webpage using a server-side script?

I need a server-side script (PHP, Python) to capture a webpage to a PNG, JPG, Tiff, GIF image and resize them to a thumbnail.
What is the best way to accomplish this?
See also:
Web Page Screenshots with PHP?
How can I take a screenshot of a website with PHP and GD?
How might I obtain a Snapshot or Thumbnail of a web page using PHP?
You can probably write something similar to webkit2png, unless your server already runs Mac OS X.
UPDATE: I just saw the link to its Linux equivalent: khtml2png
See also:
Create screenshots of a web page using Python and QtWebKit
Taking automated webpage screenshots with embedded Mozilla
What needs to happen is for a program to render the page and then take an image of the page. This is a very slow and heavy process but it can be done in PHP on Windows.
Also check the comments in the documentation article.
For python I'd recommend reading this article. It highlights some of the solutions.
There are services you can also call (via some API) that will return you an image. But usually they cost (WebShots for example)
You'll need to:
read the webpage and all the its multimedia content (images, flash, etc)
utilize a browser rendering engine to render the webpage
take a screenshot and save it as image
first and third steps are easy, the second step is more challenging ;)
If you are using php, you could use imagegrabscreen (PHP 5 >= 5.2.2). Imagegrabscreen: captures the whole screen.

Categories