<?php /** * i.php: Zenphoto image processor * All *uncached* image requests go through this file * (As of 1.0.8 images are requested directly from the cache if they exist) ***************************************************************************
**** * URI Parameters: * s - size (logical): Based on config, makes an image of "size s." * h - height (explicit): Image will be resized to h pixels high, w is calculated. * w - width (explicit): Image will resized to w pixels wide, h is calculated. * cw - crop width: crops the image to cw pixels wide. * ch - crop height: crops the image to ch pixels high. * cx - crop x position: the x (horizontal) position of the crop area. * cy - crop y position: the y (vertical) position of the crop area. * q - JPEG quality (1-100): sets the quality of the resulting image. * t - Set for custom images if used as thumbs. * * Cropping is performed on the original image before resizing is done. * - cx and cy are measured from the top-left corner of the image. * - One of s, h, or w _must_ be specified; the others are optional. * - If more than one of s, h, or w are specified, s takes priority, then w+h: * - If none of s, h, or w are specified, the original image is returned. ***************************************************************************
**** * @package core */ // force UTF-8 O // Check for minimum parameters. imageError(gettext("Too few arguments! Image not found."), 'err-imagenotfound.gif'); } // Fix special characters in the album and image names if mod_rewrite is on: // URL looks like: "/album1/subalbum/image/picture.jpg" list($ralbum, $rimage) = rewrite_get_album_image('a', 'i'); $ralbum = internalToFilesystem($ralbum); $rimage = internalToFilesystem($rimage); $theme = themeSetup($album); // loads the theme based image options. // Extract the image parameters from the input variables // This validates the input as well. } } } $args[3] = $_GET['cw']; } $args[4] = $_GET['ch']; } $args[5] = $_GET['cx']; } $args[6] = $_GET['cy']; } $args[7] = $_GET['q']; } //8 thumb //9 crop $args[10] = $_GET['t']; } $args[11] = $_GET['wmk']; } $args [12] = $adminrequest; //12 $args[13] = $_GET['gray']; } // No image parameters specified if (getOption('album_folder_class') !== 'external') { header("Location: " . getAlbumFolder(FULLWEBPATH) . pathurlencode(filesystemToInternal($album)) . "/" . rawurlencode(filesystemToInternal($image))); return; } // external album, Web server cannot serve original image. Force resize to as big as we can do $args[0] = MAX_SIZE; } $args = getImageParameters($args,filesystemToInternal($album)); list($size, $width, $height, $cw, $ch, $cx, $cy, $quality, $thumb, $crop, $thumbstandin, $passedWM, $adminrequest, $gray) = $args; if (DEBUG_IMAGE) debugLog("i.php($ralbum, $rimage): \$size=$size, \$width=$width, \$height=$height, \$cw=$cw, \$ch=$ch, \$cx=$cx, \$cy=$cy, \$quality=$quality, \$thumb=$thumb, \$crop=$crop, \$thumbstandin=$thumbstandin, \$passedWM=$passedWM, \$adminrequest=$adminrequest, \$gray=$gray"); $allowWatermark = !$thumb && !$adminrequest; // Construct the filename to save the cached image. $newfilename = getImageCacheFilename(filesystemToInternal($album), filesystemToInternal($image), $args); $newfile = SERVERCACHE . $newfilename; $imgfile = getAlbumFolder() . $image; } else { $imgfile = getAlbumFolder() . $album.'/'.$image; } if ($debug) imageDebug($album, $image, $args, $imgfile); /** Check for possible problems *********** ******************************************/ // Make sure the cache directory is writable, attempt to fix. Issue a warning if not fixable. @chmod(SERVERCACHE, CHMOD_VALUE); imageError(gettext("The cache directory does not exist. Please create it and set the permissions to 0777."), 'err-cachewrite.gif'); } @chmod(SERVERCACHE, CHMOD_VALUE); imageError(gettext("The cache directory is not writable! Attempts to chmod didn't work."), 'err-cachewrite.gif'); } $imgfile = $rimage; // undo the sanitize // then check to see if it is a transient image if ($i !== false) { if ($i !== false) { } else { $source2 = ''; } if ($source != ZENFOLDER) { $source = THEMEFOLDER.'/'.$source; } $args[3] = $args[4] = 0; $args[5] = 1; // full crops for these default images $args[9] = NULL; $imgfile = SERVERPATH .'/'. $source.$source2 . "/" . $imgfile; } imageError(gettext("Image not found; file does not exist."), 'err-imagenotfound.gif'); } } // Make the directories for the albums in the cache, recursively. // Skip this for safe_mode, where we can't write to directories we create! $albumdirs = getAlbumArray($album, true); foreach($albumdirs as $dir) { $dir = internalToFilesystem($dir); $dir = SERVERCACHE . '/' . $dir; @chmod($dir, CHMOD_VALUE); @chmod($dir, CHMOD_VALUE); } } } $process = true; // If the file exists, check its modification time and update as needed. $process = false; } } if ($process) { // If the file hasn't been cached yet, create it. // setup standard image options from the album theme if it exists if (!cacheImage_protected($newfilename, $imgfile, $args, $allowWatermark, false, $theme, $album)) { imageError(gettext('Image processing resulted in a fatal error.')); } } $path = $_zp_conf_vars['cache_folder'] . internalToFilesystem(imgSrcURI($newfilename)); if (!$debug) { $suffix = getSuffix($newfilename); switch ($suffix) { case 'bmp': $suffix = 'wbmp'; break; case 'jpg': $suffix = 'jpeg'; break; case 'png': case 'gif': case 'jpeg': break; default: pageError(405, gettext("Method Not Allowed")); } //header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($imgfile)).' GMT'); //header('HTTP/1.1 304 Not Modified'); } //header('Content-Length: ' . filesize($path)); //@ob_clean(); //@flush(); } } else { } ?>
W czym rzecz? Ten kod tworzy miniaturki w locie, ale... Dla pewnych zdarzeń zwraca je ( w FireBug są widoczne i w FF jak się da 'Odśwież obrazek' ), ale dla HTML nie, dlaczego tak się dzieje? Jak to można zmienić?
PS. Komentarze można usunąć.