PHP creating mp3 from different mp3s [duplicate] - php

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Combine/Concatenate MP3s on Server Using PHP
I would like to create a 30 minutes mp3 by combining about 1000 small mp3s together.
Is that kind of thing doable using PHP or the ressources usage would be too costly in CPU/bandwidth?
For example, I would like "Ronaldhino dekes player X and is on the run! Great kick! etc."

There is an library called getID3. It has the ability to join multiple MP3 files into one , although I have never used this functionality. There is an demo available at the Source Forge site of getID3 here http://getid3.sourceforge.net/source/demo.joinmp3.phps. It seems that it works around without using any command line system calls.
I have used this library for getting lengths and other data from various media formats. It worked like a charm. However, as said, I have not tested the CombineMultipleMP3sTo() function in it...
You should test this as if it would work for you it would be a far easier option than LAME (which is powerful yet rather complicated to use in my opinion).

Related

Convert higher bitrate mp3 files to lower bitrate in PHP

I developed a system that contains many MP3 files that users can listen to them online/stream, since most of my users are Iranians and Iran internet speed is sucks, I came up with an idea, but I can’t find the right/best way to do that.
I have alots of different berates: 128kps, 192kps, 320kps, etc… I would like to know what’s the best way to remotely convert these files to 32/64kps qualitie, and of course, temporarily.
I mean, after the new file 32kbps generated. After period of time the generated file automatically delete.
I did lots of search before I ask this question, but none of the results answered my question.
BTW, I find the LAME library.
Is there a way to do that with pure PHP?
Is there a way to do that with pure PHP?
Nope. Not at all. PHP is a server-side scripting language that depends on add-ons & external functions. That said, there is a SWFMovie::streamMP3 function, but as the page says, “This function is EXPERIMENTAL.”
You are much better off learning about MP3 streaming software like Mopidity which is a Python-based music server. Might also look into Andromeda which appears to be PHP-based. And such. Reinventing the wheel will not be fun at all. You are better off researching how to use Open Source MP3 streaming software as best as possible & adapt it for your needs.

Fastest possible way to download many images in PHP 5.3? [duplicate]

This question already has answers here:
PHP Parallel curl requests
(3 answers)
php get all the images from url which width and height >=200 more quicker
(4 answers)
Closed 9 years ago.
Im working on script that integrates online shops.
I have code like this (simplified):
// $asImageurls - array of string with image url's
foreach($asImageurls as $sImageUrl)
{
$imageContent = #file_get_contents($image);
// create filename, save image etc.
}
Connecting with remote server, downloading image takes a lot of time, and this is not good when I have like 500 products to import.
I was thinking about some parallel downloading, but I don't know how to start.
What can I do, to make it faster?
There are two main solutions to this problem:
1) Instead of downloading your images directly, store all urls in a file (also eventually the destination path). Then, use cron to call a script every n minutes that will do the downloads for you. This is the best way to avoid server overload if a lot of people submit downloads at the same time.
2) Use the exec() PHP function. This way you could call every system command you want. Typically curl in your case. This way you can add & at the end to throw it in background. You can even store warnings and errors redirecting them to a file.

Create an image from an url using PHP GD [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to save webpage as a image file using PHP?
I would like to create an image on the server using a url string that is given.
I want a screen shot of a website to be created.
Is it possible with PHP GD , if so how ?
Thanks
You need something like PhantomJS to do it. This can be called from PHP.
Pretty sure GD can't handle this by itself. You'd need an HTML renderer too.
As far as I know, there is no existing PHP-Lib, which can do this. PHP-GD has to do with graphics, but you cant do this with it. Even if: What will happen, if the Site uses Javascript to enable certain important parts of a site? Or even images or other resources, that require long running requests? Or consider sites using flash... There are some tools for linux to take screenshots in batch - configurable with timer etc.

How can I get the thumbnail of a website? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Website screenshots using PHP
I want to create a script that will show the thumbnail of a site (let's say 400*300px ). I don't want sites like www.bitpixels.com .
So the answear could come in 2 ways:
1) You explain how could I take the screenshot of a website (using only PHP,ajax, etc,... no .NET or other stuff like that :D )
2) You know a website that offers this type of service for free and there's no limitation in the number of thumbs you can get, or their size.
You may want to try wkhtmltopdf (webkit-based html to pdf conversion), it also contains wkhtmltoimage, a version of it that outputs images. It's open source and if you have any sort of dedicated machine you should be able to use it. Otherwise I am not sure. Since it is webkit based it should provide you with a decent rendering of the page too.
Another great tool for this is PhantomJS

Converting HTML to PDF using PHP? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Convert HTML + CSS to PDF with PHP?
Is it possible to convert a HTML page to PDF using PHP, and if so, how can it be done?
Specifically, the page is an invoice generated dynamically. So I would like it loaded using:
http://example.com/invoices/3333
And the HTML output would have to be converted to PDF.
Any good libraries that do this will be fine.
If you wish to create a pdf from php, pdflib will help you (as some others suggested).
Else, if you want to convert an HTML page to PDF via PHP, you'll find a little trouble outta here.. For 3 years I've been trying to do it as best as I can.
So, the options I know are:
DOMPDF : php class that wraps the html and builds the pdf. Works good, customizable (if you know php), based on pdflib, if I remember right it takes even some CSS. Bad news: slow when the html is big or complex.
HTML2PS: same as DOMPDF, but this one converts first to a .ps (ghostscript) file, then, to whatever format you need (pdf, jpg, png). For me is little better than dompdf, but has the same speed problem.. but, better compatibility with CSS.
Those two are php classes, but if you can install some software on the server, and access it throught passthru() or system(), give a look to these too:
wkhtmltopdf: based on webkit (safari's wrapper), is really fast and powerful.. seems like this is the best one (atm) for converting html pages to pdf on the fly; taking only 2 seconds for a 3 page xHTML document with CSS2. It is a recent project, anyway, the google.code page is often updated.
htmldoc : This one is a tank, it never really stops/crashes.. the project looks dead since 2007, but anyway if you don't need CSS compatibility this can be nice for you.

Categories