phpISO is a small application to make images from CDs.

phpISO screendumpphpISO is very small, but very easy to use and very fast. It only works under Linux! You enter a device, for example /dev/cdrom and phpISO makes a similar image of it.



Not sure what the point is ; it seems to be equivalent to:
cat /dev/cdrom > image.iso


yes, but it's graphical application. It would be interesting to show a progress bar. Don't know how to get ISO size.

perhaps a solution for size

this function works for CD, CD audio, but not exactly right size returned ; but does not works for DVD (return 50% of real size) ; may not work with multi-session CD/DVD.

function seek_size($dev, $debug=false) {
$dev = @fopen($dev,"r");
        if (!
$dev) return FALSE;
$size = 0;
$block_size = 1024 * 1000;

/* should return file size ; does not work with /dev/cdrom devices
        fseek($dev, 0, SEEK_END);
        $filesize = ftell($dev);
        if($pos === false)
            echo "ftell error\n";
            echo "filesize = $filesize\n";

$size = 0;
$block_size = 1024 * 1000 * 10;
        while (
fseek($dev, $block_size, SEEK_CUR) != -1) {
$pos = ftell($dev);

$pos == false)
"."; flush();


"size = $size\n";
"pos = $pos\n";

DVD size

For DVDs and larger media, you have to take into account the fact that the size is larger than 2GB, meaning traditional (signed) long integers, which are 31 bits wide, will suffer from folding. Even unsigned integers, at 32 bits, will be truncated too.

Using either GMP or bcmath to obtain arbitrary precision might be required.



I didn't add a progressbar because I wanted to avoid traffic.
But I think I will add a progressbar. But first I have to find a solution for getting the size of a CD.

size info

- for DVD, there is an external command available on linux : lsdvd ; there is some options and is easy parsable.
- for IO, I think you should use IO_add_watch ; this allow a non-blocking IO system. Here is the synopsys :

- $conditions = (Gtk::IO_IN, Gtk::IO_OUT, IO_PRI, IO_ERR, IO_HUP, IO_NVAL);

- $id = io_add_watch($stream_rsrc, $condition, $callback);
- $id = io_add_watch($stream_rsrc, $condition, $callback, $priority);

you can find some sample script here or anywhere.

phpISO 0.2


I finished phpISO 0.2.
phpISO 0.2 need df to get the size of the CD. The CD has also to be mounted.
Have fun ;)

Opções de exibição de comentários

Escolha seu modo de exibição preferido e clique em "Salvar configurações" para ativar.