2011-12-28, 01:52:04
mvlcek Wrote:The main reason for routing all image requests through pic.php is the resizing of thumbs and images on-the-fly to the thumb and image sizes requested.I know your flexibility is great. This is the reason why I stopped my first idea as the flexibility is gone immediately.
As you can specify a different thumb or image size in the call, this is the only way to do it, e.g. if you specify a fancybox gallery mygallery with thumb sizes 120x90, you can also call the gallery with (% gallery type=prettyphoto thumbwidth=160 thumbheight=120 %).
Quote:So resizing the images when defining the gallery won't work,clear!
Quote:and resizing all images on page load would take too much time.not clear ?!
Quote:A second reason is that I want to limit access to the images and show some images only to registered users.I wasn't aware that this is possible and in the meantime I made my own solution.
Is it possible to limit access to different images/ galleries for different user(groups)?
Quote:I'll try to implement a better method:I created now a similar solution. A little bit manually.
- if no veto filter for images is registered and the thumbnail/image exists, link to the image file.
- otherwise, if the image needs to be resized, pic.php should resize the image and redirect either to the image or to a script checking access rights
- otherwise links to the script checking access rights.
Code:
if (isset($_GET['php'])){
$link = i18n_gallery_site_link().'plugins/i18n_gallery/browser/new-pic.php?g='.$gallery['name'].'&p='.urlencode($item['filename']).'&w='.$tw.'&h='.$th.($tc?'&c=1':'');}
}
Code:
function i18n_gallery_thumb_link($gallery, $item=null, $echo=true) {
if (!is_array($item)) $item = @$gallery['items'][-intval($item)-1];
if (!$item) $item = @$gallery['items'][0];
$tw = @$gallery['thumbwidth'];
$th = @$gallery['thumbheight'];
$tc = @$gallery['thumbcrop'] && $tw && $th;
$infile = preg_replace('/\.+\//', '', $item['filename']);
$infile = str_replace("//","/",$infile);
$pos = strrpos($infile,'/');
if ($pos === false) $pos = -1;
$outfile = substr($infile, 0, $pos+1) . 'i18npic.' . ($tc ? 'C' : '') . ($tw ? $tw.'x' : '0x') . ($th ? $th.'.' : '0.') . substr($infile, $pos+1);
$outfile = substr($outfile, 0, strrpos($outfile,'.')) . '.jpg';
$thumbdir = './data/' . 'thumbs/';
$link = $thumbdir.$outfile;
if (isset($_GET['php'])){
$link = i18n_gallery_site_link().'plugins/i18n_gallery/browser/new-pic.php?g='.$gallery['name'].'&p='.urlencode($item['filename']).'&w='.$tw.'&h='.$th.($tc?'&c=1':'');}
if ($echo) echo str_replace('&','&',$link); else return $link;
}
Quote:Alternatively outputting caching headers for the images returned by pic.php might work - or not, because there are URL parameters?Häh!??????
bydey
my getsimple page deynews.de