From: "Tom Keays"

> Has anyone ever put together a HOWTO for serving abc, midi, gif, png, and
> pdf from a server?  I know of the various abc projects from sourceforge
and
> elsewhere.  I've checked out bits of it casually but haven't really
figured
> out how you get past abc2ps (ie, I see how to get from abc to postscript,
> but not beyond that).

I've never seen one but I think John Chambers allows his source to be
downloaded from his site.  I'm sure I've looked at some perl there to see
how he went about things...

If you can see how to get to ps, you can also see how to get to midi. Again
it's a single step process but you need to run something like abc2midi . To
get to the other formats, you need to pass the output from your abc2ps
program to another program, e.g. by a temorary file.  I run ghostscript for
png and pdf. I haven't bothered with gif - I can't do it with my version of
ghostscript.

For what it's worth, here's my actual getpng.php. It needs a bit of
improving but it does the job for now.

<?php

// get the tune from the database
$Connection = mysql_connect("connection", "username", "password");
mysql_select_db("songdb");
$SQL = "Select Tune from Song Where SongID=" . $_GET["SongID"];
$result = mysql_query($SQL);
$row = mysql_fetch_array($result);
$abc = $row[0];

// transpose if needed and write "out.abc"
if (@$_GET["t"]){
 $fp = fopen("out1.abc", "wb");
 fwrite($fp, $abc);
 fclose($fp);
 $prog = "abc2abc.exe out1.abc -e -t " . $_GET["t"] . " >out.abc";
 exec($prog);
 }
else
 {
 $fp = fopen("out.abc", "wb");
 fwrite($fp, $abc);
 fclose($fp);
 }

// run abcm2ps and output "out.ps"
$prog = "abcm2ps.exe out.abc -w 550 -O ..\gs\gs7.04\bin\out.ps";
exec($prog);

// run ghostscript and output out.png
chdir("..\gs\gs7.04\bin");
exec("gswin32c.exe -dNOPAUSE -dBATCH -sDEVICE=pngmono -sOutputFile=out.png
out.ps");

// set the headers and send the graphic to the browser
header ("Content-type: image/png");
header("Content-Disposition: filename= " . chr(34) . "getpng.png" .
chr(34));
readfile("out.png");

?>

To subscribe/unsubscribe, point your browser to: http://www.tullochgorm.com/lists.html

Reply via email to