PX : code

Image Magic Converter 39 Format to Web Graphics by Patrik
Download this code


<?php
function tumbnail_final ($dirlavoro,$fotonamew) {
global 
$coloreuno$coloredue $coloretre $thumbnail_misura;
$takebild="$dirlavoro$fotonamew";
$width=$thumbnail_misura;
$height=$thumbnail_misura;
$im imagecreate($width,$height); 
$grigio ImageColorAllocate($im$coloreuno,$coloredue,$coloretre ); 
$black ImageColorAllocate($im0,0,0);
if (!
file_exists($takebild)) {
ImageString ($im155,  "ERRORE IL FILE MANCA"$black);
$tmpfile=$dirlavoro"_errore.png";
ImagePNG($im"$tmpfile");
}
else {
$parambild GetImageSize"$takebild"); 
$largo $parambild[0]; 
$alto$parambild[1]; 
$width=120;
$height=120;
$bigmap=ImageCreateFromPNG("$takebild"); 
ImageFilledRectangle($im,0,0,$width,$height,$grigio);
if (
$largo=="$width") {
$neualtodif=$height $alto;
$distanza=$neualtodif 2;
ImageCopyResized($im$bigmap0$distanza00$largo$alto$largo$alto);
$tmpfile=eregi_replace("-temp.png","-tbm.png",$takebild);
ImagePNG($im,"$tmpfile");
}
elseif (
$height=="$alto") {
$neualtodif=$width $largo;
$distanza=$neualtodif 2;
ImageCopyResized($im$bigmap$distanza00$largo$alto$largo$alto);
$tmpfile=eregi_replace("-temp.png","-tbm.png",$takebild);
ImagePNG($im,"$tmpfile");
}
}
return 
$tmpfile;
}

//dacancellare $tmpfile rispettivamente $fotonamew
//il primo 0 distanya da sinistra
//il secondo 0 distanza da sopra

function errornodatamsg () { /* customise your error message */ 
echo"<br><br><div align=\"center\"><h3>Error! No Data or Comment or Name?</h3><br><br>
<a href=\"index.php3\">INDEX</a><br><br></div>
</body>
</html>"
;
}
function 
errormsg () { /* customise your error message */ 
global $maxsize;
global 
$largo//white//
global $alto;  //hight// from uploadet pic //
echo"<br><br><div align=\"center\"><h3>Errorore!<br>
Larghezza massima Impostata $maxsize pixel</h3><br>
Attualmente la Vostra immagine dispone una larghezza di:$largo altezza:$alto (Se &egrave; un immagine)<br>
<a href=\"$PHP_SELF\">Riprova</a>
<br><br></div>
</body>
</html>"
;
}
function 
form_post() {
?>

<h2>Image Converter <br>Generate Thumbnail</h2>
<form action="<?php echo"$PHP_SELF"?>" method="post" enctype="multipart/form-data">
<input type="File" name="pic">
<input type="hidden" name="MAX_FILE_SIZE" value="400000">
<input type="Submit" name="putin" value="Send">
</form>
<?php
}
?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.