I was recently asked to come up with a script that will allow the end user to upload a PSD (Photoshop) file, and split it up and create images from each of the layers.
I would love to stay with PHP for this, but I am open to Python or Perl as well.
Any ideas would be greatly appreciated.
Using GraphicsMagick or ImageMagick along with Magick++, you can then use imagick.
imagick has all of the calls necessary to convert PSDs from layers, including doing masks.
You can try the PHP PSD Reader, which should at least get you started.
Related
I'm working on a project and i have all the help related to the business in hlp files, i'm looking for a php viewer for that kind of files but i have not found any so far, not even a payed one.
is there any library for displaying HLP files in PHP?
Thanks in advance.
I couldn't find one for PHP, but there are various ones for Linux. You could convert it there, using system(), and then pick up the output.
i run a job search site, and i need to convert doc, docx and pdf files into HTML on linux CentOS server running php. People submit these files as resumes. So far, I found PHPDocx to be great at converting docx to html. But I am stuck at doc/pdf. PDFTOHTML gives error "bad color" when i run tests. As far as doc, i only found wvwave, which seems complex and bulky to install.
does anyone have any ideas on how to easily convert doc/pdf to HTML?
The only thing i can think of is FPDF.
It is intended for creating PDF files in PHP but it can also open PDF files.
Maybe you can use that as a base and develop some sort of toHTML function for it.
It is completely free to use and it has some extensions already.
It MIGHT help you.
http://www.fpdf.org
EDIT:
Thanks for the addition to my post in the comments to Pierre:
You can use fpdi: http://www.setasign.de/products/pdf-php-solutions/fpdi but the input pdf is just like an image.
I havent taken a look at it myself so far but this might help.
As far as .doc files go how about trying OpenOffice/LibreOffice, something like:
lowriter -convert-to html doc_file.doc –
As far as PDF goes, if the PDF is a graphical representation of text then you're out of luck, best you can do is try convert it to an image with ImageMagick, if it is a proper text it should easily convert.
There are various tools out there already to do this, such as http://dag.wieers.com/home-made/unoconv/, http://www.phpdocx.com/ (which you've already tried)
http://www.phplivedocx.org/2009/08/13/convert-docx-doc-rtf-to-html-in-php/ looks promising.
Or, you could install a portable version of libreoffice on your server which allows command line conversion
https://help.libreoffice.org/Common/Starting_the_Software_With_Parameters
I'm sure there'll be tutorials out there (on libreoffice support area)
To easily convert pdf to html, I would suggest pdf2htmlEX which produces outstanding HTML and is fast enough for runtime converting. You should first put some effort to optimize and build it for your system. There is simple build howto included on the project link.
I have my own video sharing app,
My question is... is there any library,script or something else, to help me in rotating videos whatever their file extension is?
Many peoples are uploading videos but sometimes i found video (guessing shared with iphones or mobile phones) and i see them horizontally instead of vertically...
Does anyone have any ideas how to rotate them dynamically?
Im not familiar with any "libraries" that will do that. I think your better bet would be to find a command-prompt-enabled video software package (like Any Video Converter [See Q7]) that PHP can execute via command prompt on the fly.
PHP doesn't do that, and there are no extensions that I know off, made for that purpose.
You can use ffmpeg to manipulate videos, by calling it from your scripts (see shell_execute() and such functions). Reading the ffmpeg documentation will help you figure what can (and can't) be done with that powerful tool.
I need to extract the icon (.ico file) out of an executable (.exe).
I need it for PHP on Windows. Any Ideas?
I originally thought that ImageMagick will extract icons from .exe files. However, it seems my memory is failing me.
Instead, since you are prepared to accept the use of exec I think the quickest and easiest solution will be to use a tool like ResHacker. The can be driven in command-line mode. Then if you need to convert from .ico to .png, as per your last question, you can reach for ImageMagick.
Does anybody know a ready-made, reliable way to tell the dimensions (width x height) of a MP4 encoded using the H.264 codec without ffmpeg or similar extensions, in pure PHP?
Thanks for all the answers folks. The bounty is running out and I will not have time to check the offered solutions before it does. I will accept the solution that I feel has the greatest likelihood to work.
getID3 is pure php and extracts an amazing amount of information from media files of all sorts. It will depend on what encoded your file in the first place as to what metadata is available and how reliable it is. getID3 has a nice demo page with lots of different file types. I tried to post more links but as a newbie I only get one.
It sounds like http://code.google.com/p/php-mp4info/ might be your answer. It reads MP4's but it doesn't mention anything about H.264.
also, what OS are you using?
What comes to mind:
mediainfo a huge project with GUI, but also has a CLI
mp4info (part of the seemingly defunct mp4mpeg project) is almost perfect for this
ffmpeg although this is overkill for the task. then again, you very well may need it for other tasks
ffmpeg and php: http://www.lampdeveloper.co.uk/linux/detecting-a-videos-dimensions-using-php-and-ffmpeg.html
php-reader is a full implementation of the ISO 14496 done in pure PHP. You can use this library to read all of the boxes which the mp4 consist of, like the moov atom containing metadata about the file.
Native PHP does not support anything like this, ffmpeg is only one library that come on my mind.