Archived
1
0
Fork 0

don't use DIRECTORY_SEPARATOR for URL paths (fixes #58)

This commit is contained in:
Jan Dittberner 2009-07-15 21:32:11 +00:00
parent 050caa5830
commit a165f02bea

View file

@ -237,20 +237,19 @@ function getScaledImage($galleryname, $basename, $maxdim, $scaleheight=true) {
}
$gallerydir = realpath($configuration['gallerydir'] . DIRECTORY_SEPARATOR . $galleryname);
if ($scaleheight) {
$scaleddir = sprintf("%s%sscaled_x%d", $galleryname,
DIRECTORY_SEPARATOR, $maxdim);
$scaleddir = sprintf("scaled_x%d", $maxdim);
} else {
$scaleddir = sprintf("%s%sscaled%dx_", $galleryname,
DIRECTORY_SEPARATOR, $maxdim);
$scaleddir = sprintf("scaled%dx_", $maxdim);
}
$scaleddirpath = $configuration['gallerydir'] . DIRECTORY_SEPARATOR . $scaleddir;
$scaleddirpath = implode(DIRECTORY_SEPARATOR,
array($configuration['gallerydir'], $galleryname, $scaleddir));
if (!is_dir($scaleddirpath)) {
// versuchen das Thumbnail-Verzeichnis anzulegen
$mkdir = @mkdir($scaleddirpath, 0755);
if (!$mkdir) {
trigger_error("could not create directory $scaleddirpath.\n",
E_USER_WARNING);
return $galleryname . DIRECTORY_SEPARATOR . $basename;
return $galleryname . '/' . $basename;
}
}
@ -275,7 +274,7 @@ function getScaledImage($galleryname, $basename, $maxdim, $scaleheight=true) {
$origx, $origy);
imagejpeg($newimage, $scaledimage, 90);
}
return $scaleddir . DIRECTORY_SEPARATOR . $basename;
return implode('/', array($galleryname, $scaleddir, $basename));
}
/**
@ -377,7 +376,7 @@ function getAllThumbnails(&$thumbinfo) {
$retval = array();
foreach ($thumbinfo[2] as $basename => $data) {
$retval[] = array('src' => $configuration['gallerypath'] . DIRECTORY_SEPARATOR . $data[0],
$retval[] = array('src' => $configuration['gallerypath'] . '/' . $data[0],
'sizes' => $data[1][3],
'alt' => getImageLabel($thumbinfo[1], $basename));
}
@ -405,8 +404,7 @@ function getFirstPreview(&$thumbinfo) {
$basename = key($thumbinfo[2]);
$data = current($thumbinfo[2]);
$galleryname = $thumbinfo[1];
$fullname = $configuration['gallerypath'] . DIRECTORY_SEPARATOR . $galleryname .
DIRECTORY_SEPARATOR . $basename;
$fullname = $configuration['gallerypath'] . '/' . $galleryname . '/' . $basename;
$scaledimage = getScaledImage($galleryname, $basename,
$theme->previewsize, false);
$scaledimagesize = getimagesize(realpath($configuration['gallerydir'] .
@ -415,7 +413,7 @@ function getFirstPreview(&$thumbinfo) {
$label = getImageLabel($galleryname, $basename);
return array('title' => $label,
'full' => $fullname,
'src' => $configuration['gallerypath'] . DIRECTORY_SEPARATOR . $scaledimage,
'src' => $configuration['gallerypath'] . '/' . $scaledimage,
'alt' => $label,
'sizes' => $scaledimagesize[3]);
}