function generate_images($quality, $width_image, $height_image, &$actwoa, &$acthoa, $corner_radius, $color, $grcolor, $button_text, $text_height, $text_color, $back_color, $font_style, $rcolor, $rgrcolor, $rtext_color, $image_locate, $image_height, $image_name, $image_foreground, $image_foregroundcolor, $image_transparent, $image_transparentcolor, $fonts, $defaultzipexists) { // produce a temporary image file $deletetemppath = $defaultzipexists ? tempnam(IMGPATH, "") : IMGPATH . "/" . basename(DEFAULTZIP, ".zip"); $tmpimgpath = $deletetemppath . "d"; mkdir($tmpimgpath, 0700); $imgpath = $tmpimgpath . "/button_0.png"; $gifimgpath = $tmpimgpath . "/button_0.gif"; $jpgimgpath = $tmpimgpath . "/button_0.jpg"; $rimgpath = $tmpimgpath . "/button_1.png"; $rgifimgpath = $tmpimgpath . "/button_1.gif"; $rjpgimgpath = $tmpimgpath . "/button_1.jpg"; $readmepath = $tmpimgpath . "/" . READMENAME; $font_name = $fonts->GetFontNameFromIndex($font_style - 1); // generate the readme text glassy_readme($readmepath, $button_text, $color, $grcolor, $width_image, $height_image, $corner_radius, $text_height, $text_color, $back_color, $font_name, $quality, $rcolor, $rgrcolor, $rtext_color, $image_locate, $image_height, $image_name, $image_foreground, $image_foregroundcolor, $image_transparent, $image_transparentcolor); $zippath = $deletetemppath; @unlink($deletetemppath); $qualityfactor = $quality; $font_path = $fonts->GetFontPathFromIndex($font_style - 1); $im = MakeGradientFilledButtonPolygon($qualityfactor, $width_image, $height_image, $actwoa, $acthoa, $corner_radius, $color, $grcolor, $button_text, $text_height, $text_color, $back_color, $image_locate, $image_height, $image_name, $image_foreground, $image_foregroundcolor, $image_transparent, $image_transparentcolor, $font_path); // Header ('Content-type: image/png'); @rename($im, $imgpath); @unlink($im); chmod($imgpath, 0644); @exec(IMCONVERT . " {$imgpath} -quality 100 {$jpgimgpath}"); chmod($jpgimgpath, 0644); // create the rollover image $rim = MakeGradientFilledButtonPolygon($qualityfactor, $width_image, $height_image, $actwoa, $acthoa, $corner_radius, $rcolor, $rgrcolor, $button_text, $text_height, $rtext_color, $back_color, $image_locate, $image_height, $image_name, $image_foreground, $image_foregroundcolor, $image_transparent, $image_transparentcolor, $font_path); // Header ('Content-type: image/png'); @rename($rim, $rimgpath); @unlink($rim); chmod($rimgpath, 0644); @exec(IMCONVERT . " {$rimgpath} -quality 100 {$rjpgimgpath}"); chmod($rjpgimgpath, 0644); // create a zipped version if (file_exists($imgpath) && file_exists($jpgimgpath) && file_exists($rimgpath) && file_exists($rjpgimgpath)) { $zip = new ZipArchive(); if ($zip->open($zippath . ".zip", ZIPARCHIVE::CREATE) !== TRUE) { exit("cannot open <{$zf}>\n"); } $zip->addFile($imgpath, basename($imgpath)); $zip->addFile($jpgimgpath, basename($jpgimgpath)); $zip->addFile($rimgpath, basename($rimgpath)); $zip->addFile($rjpgimgpath, basename($rjpgimgpath)); $zip->addFile($readmepath, basename($readmepath)); $zip->close(); } @unlink($imgpath); @unlink($jpgimgpath); @unlink($rimgpath); @unlink($rjpgimgpath); @unlink($readmepath); @rmdir($tmpimgpath); $ourfilesize = @filesize($zippath . ".zip"); // now check to see if the new file is identical to any existing files $dirlist = glob(IMGPATH . "/*.zip"); foreach ($dirlist as $file) { // for every file not equal to the one we just made if (basename($zippath . ".zip") != basename($file)) { // if it's the same size as another file if (@filesize($file) == $ourfilesize) { // inspect the urls of each zip package get_zip_url(basename($file, ".zip"), $url1); get_zip_url(basename($zippath), $url2); if (strcmp($url1, $url2) == 0) { // no difference found, use this file instead @unlink($zippath . ".zip"); $zippath = IMGPATH . "/" . basename($file, ".zip"); break; } } } } // set new permissions chmod($zippath . ".zip", 0644); // tell the caller where to look for the new file! return IMGPATH . "/" . basename($zippath); }
</td></tr> </table> <table style="text-align:center;margin-left:auto;margin-right:auto;width:700px;"> <tr><td><hr /></td></tr> <?php $index = 0; $exhausted = true; foreach (glob(IMGPATH . "/*.zip") as $zipfile) { if ($index >= $startindex + $buttonsperpage) { $exhausted = false; break; } if ($index >= $startindex) { $basen = basename($zipfile, ".zip"); get_zip_url($basen, $url); $url = $url . "&" . USECACHE . "=" . $basen; $basep = IMGPATH . "/" . $basen; $imgbaseurl = "http://" . BASEURL . $_SERVER['REQUEST_URI']; $imgbaseurl = substr($imgbaseurl, 0, strpos($imgbaseurl, basename($_SERVER['SCRIPT_FILENAME']))) . "image.php?name="; $baseid = "glassy"; $baseid .= str_replace(".", "x", $basen); echo "<tr><td>\n"; echo "<script type='text/javascript'>\n"; echo "/* <![CDATA[ */\n"; echo "var " . $baseid . "_1 = new Image ();\n"; echo "var " . $baseid . "_0 = new Image ();\n"; echo $baseid . "_1.src = '" . $imgbaseurl . $basep . "_1.png';\n"; echo $baseid . "_0.src = '" . $imgbaseurl . $basep . "_0.png';\n"; echo "/* ]]> */\n"; echo "</script>\n";