GetSimple Support Forum

Full Version: I18N Gallery
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
mvlcek Wrote:Do you call get_header() in the HTML head?
Yes
html return is:
Code:
<meta name="description" content="Die meisten Bilder sind f&amp;uuml;r gute
Qualit&amp;auml;t mit 1600px abgelegt. Da dauert das Laden dann etwas l&amp;auml;nger.
F&amp;uuml;r Vollbild document.write( mit" />
<meta name="keywords" content="" />
<meta name="generator" content="GetSimple" />
<link rel="canonical" href="http://deynews.de/index.php?id=gallery" />
Quote:Try to remove the (% gallery %) on top.
is removed but I don't expect anything as the direct links from side menu results in same problem.
I still wonder why it works locally. Is permission 755 for diretories and 644 for files enough?

bydey
Hi Martin,

I checked more:
I started a new host at another freehoster: http://deynews.hostingsociety.com/ and this is working properly.
I'm not sure if I'm happy now :?

The obvious difference is

Code:
PHP Version    5.3.8 - OK                     5.3.6 - OK
cURL Module    Not Installed - Warning        Installed - OK
bydey
Quote:See here for usage within template (get_i18n_gallery_header needs to be called).

Thanks mvlcek. Sorry, it didn't quite sink in that you need both these calls - makes sense of course.
This is a very nice plugin, BTW. Thanks for making it available and supporting it so actively.

Trafford
what to do with Google map
Oleg06 Wrote:what to do with Google map

Nothing. It's work in progress that I forgot to delete.
Hi, I'm trying to figure out how to move the title text outside of the border containing the thumbnail so that it's positioned directly underneath the border. I tried to make this work by modifying plugin_fancybox.php but didn't get the result I was looking for.

Example: [Image: example.jpg]

How can this be done?

Thanks!
My little contribution for a great plugin :
my french translation Wink
Golpar Tah Wrote:Hi, I'm trying to figure out how to move the title text outside of the border containing the thumbnail so that it's positioned directly underneath the border. I tried to make this work by modifying plugin_fancybox.php but didn't get the result I was looking for.

You can probably do it with some styles in your CSS, e.g. (not tested):
Code:
body .gallery-fancybox .gallery-thumb {
  position: relative;
}
body .gallery-fancybox .gallery-thumb .gallery-title {
  position: absolute;
  left: 0;
  bottom: 30px;
}
dey Wrote:Hi Martin,

I checked more:
I started a new host at another freehoster: http://deynews.hostingsociety.com/ and this is working properly.
I'm not sure if I'm happy now :?

The obvious difference is

Code:
PHP Version    5.3.8 - OK                     5.3.6 - OK
cURL Module    Not Installed - Warning        Installed - OK
bydey

Hi Martin,

it seems that my problem on bplaced is solved: exec_php causes my trouble in combination with PHP 5.3.8.
Anyway I moved to hostingsociety and generally I like it more than bplaced.

But I found a new problem:
Some of the thumbs are allways not displayed. With F5 the thumb which is not displayed changes. Sometimes you can see all. It doesn't matter if it is the overview with random thumb or specific gallery with fixed thumbs.
If I control the thumbs folder with ftp all thumbs exists.
http://deynews.de/index.php?id=gallery

Any idea?

bydey
dey Wrote:But I found a new problem:
Some of the thumbs are allways not displayed. With F5 the thumb which is not displayed changes. Sometimes you can see all. It doesn't matter if it is the overview with random thumb or specific gallery with fixed thumbs.
If I control the thumbs folder with ftp all thumbs exists.
http://deynews.de/index.php?id=gallery

I've had this problem, when I loaded multiple files in pic.php. But I have no idea what causes it - too many open files or something like that.

So the code is not executed anymore, but gsconfig.php is loaded in pic.php. Try to comment out the following lines:
Code:
/*
$load['plugin'] = true;
if (file_exists('../../../gsconfig.php')) {
  require_once('../../../gsconfig.php');
}
*/
mvlcek Wrote:
Golpar Tah Wrote:Hi, I'm trying to figure out how to move the title text outside of the border containing the thumbnail so that it's positioned directly underneath the border. I tried to make this work by modifying plugin_fancybox.php but didn't get the result I was looking for.

You can probably do it with some styles in your CSS, e.g. (not tested):
Code:
body .gallery-fancybox .gallery-thumb {
  position: relative;
}
body .gallery-fancybox .gallery-thumb .gallery-title {
  position: absolute;
  left: 0;
  bottom: 30px;
}
Thanks! That got me half way there. The text is now below the thumbnail but I'm unable to center it and there's nothing to keep the longer titles from spilling over the boundaries of the thumbnail. I imagine creating some sort of an invisible wrapper below each thumbnail in the CSS would solve the problem but I'm unsure how to properly code that. What would you suggest?
Hi Martin,

I hope you had or still have a relaxing xmas. I already returned to my headdache Wink
Last week I reported my issue at the forum of hostingsociety. The reply was something like "bad coding" and too much resource consuming.
What is meant is the huge number os calls of pic.php like
Code:
<img src="http://deynews.hostingsociety.com/plugins/i18n_gallery/browser/pic.php?g=top-10&p=images%2F%2Fnatur%2Fstart.jpg&w=120&h=80" alt="Meine Top 10" title="Meine Top 10"/>
So I started to read and understand the complex structure.
What is the reason that you call the pic.php that often: safety or comfort?
My first idea was to change the call to pic.php into a real link to the thumbs. So far so good. But then I figured out that I would need to change it at too many location. It's too dangerous that you miss something and any change in the options corrupts everything.
So I thought it might be smarter to reduce the code for/ in pic.php.

I created a second pic.php called new-pic.php. Actually new-pic.php is the original and pic.php the reduced one.
In edit.php and imagebrowser.php I change all links from pic.php into new-pic.php. Reason: it seemed easier to find all calls...
while I write I see I was wrong!
Anyway the reduced code for pic.php looks like
Code:
<?php
$infile = preg_replace('/\.+\//', '', $_GET['p']);
$gallery = @$_GET['g'];

$maxWidth = @$_GET['w'];
$maxHeight = @$_GET['h'];
$crop = @$_GET['c'] && $maxWidth && $maxHeight;
$datadir = substr(dirname(__FILE__), 0, strrpos(dirname(__FILE__), DIRECTORY_SEPARATOR.'plugins')) . '/data/';
$imagedir = $datadir . 'uploads/';
if (!$maxWidth && !$maxHeight) {
  header('Content-Type: '.$info['mime']);
  readfile($imagedir.$infile);
} else {
  $pos = strrpos($infile,'/');
  if ($pos === false) $pos = -1;
  $outfile = substr($infile, 0, $pos+1) . 'i18npic.' . ($crop ? 'C' : '') . ($maxWidth ? $maxWidth.'x' : '0x') . ($maxHeight ? $maxHeight.'.' : '0.') . substr($infile, $pos+1);
  $outfile = substr($outfile, 0, strrpos($outfile,'.')) . '.jpg';
  $thumbdir = $datadir . 'thumbs/';

  header('Content-Type: image/jpeg');
  readfile($thumbdir.$outfile);
}

function error404() {
  header('HTTP/1.1 404 Not Found');
  header('Content-Type: text/plain');
  echo '404 File not found';
  exit(0);
}
This I tested at hostingsociety without any positive change.
While I write this I returned to my origin idea to link thumbs with clear direct links and this works.
Code for helper.php
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;
  //$link = i18n_gallery_site_link().'plugins/i18n_gallery/browser/pic.php?g='.$gallery['name'].'&p='.urlencode($item['filename']).'&w='.$tw.'&h='.$th.($tc?'&c=1':'');
  if ($echo) echo str_replace('&','&amp;',$link); else return $link;

}
What is actually missed now is the creation of thumbs (not for administration)
I manipulated the edit.php (for the other idea as well)
Code:
<td><img src="../plugins/i18n_gallery/browser/new-pic.php?p=<?php echo urlencode($item['filename']); ?>&amp;w=<?php echo $w; ?>&amp;h=<?php echo $h; ?>"/>
            <!-- pic.php -> new-pic.php and second call for normal thunmbs-->
            <img src="../plugins/i18n_gallery/browser/new-pic.php?p=<?php echo urlencode($item['filename']); ?>&amp;w=<?php echo $tw; ?>&amp;h=<?php echo $th; ?>" height="<?php echo $h*0.25; ?>"/></td>
So I call the (new-)pic.php two times to get the administration and normal thumb when I open a gallery for editing. I guess the separation pic.php and new-pic.pph is not necessary anymore.

Why do I write all this?
With this solution I can't update anymore. So I like to ask if you consider for future a solution as option which treat ressources with more care.
Even with bplaced there's is visible delay of about a second until all thumb in a gallery are visible. And I've just small galleries.

I'm looking forward to here from you.

bydey
dey Wrote:Last week I reported my issue at the forum of hostingsociety. The reply was something like "bad coding" and too much resource consuming.
What is meant is the huge number os calls of pic.php like
Code:
<img src="http://deynews.hostingsociety.com/plugins/i18n_gallery/browser/pic.php?g=top-10&p=images%2F%2Fnatur%2Fstart.jpg&w=120&h=80" alt="Meine Top 10" title="Meine Top 10"/>

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.

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 %).

So resizing the images when defining the gallery won't work, and resizing all images on page load would take too much time.

A second reason is that I want to limit access to the images and show some images only to registered users.

I'll try to implement a better method:
  • 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.
Alternatively outputting caching headers for the images returned by pic.php might work - or not, because there are URL parameters?
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.

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 %).
I know your flexibility is great. This is the reason why I stopped my first idea as the flexibility is gone immediately.

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:
  • 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.
I created now a similar solution. A little bit manually.
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':'');}

}
in the code as before in helper.php
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('&','&amp;',$link); else return $link;

}
So if I like to get new thumbs for the gallery views I need to add a &php to the url. (finally w/o new-pic.php but original pic.php)
Quote:Alternatively outputting caching headers for the images returned by pic.php might work - or not, because there are URL parameters?
Häh!??????

bydey
dey Wrote:
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 ?!

On request of the page with the gallery the plugin knows the sizes and could resize all images not yet resized and then output links to these resized images/thumbnails. However, for a gallery of more than a few images this would take to much time and would probably give you a timeout.

dey Wrote:
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)?

I have a not-yet-finished plugin similar to frontend-users, where you can define user groups based on the tags/keywords of pages and images, e.g. anonymous users see all pages/images tagged with "public", registered users get all pages/images unless tagged "private" and users in the group "friends" get all pages/images.

dey Wrote:
Quote:Alternatively outputting caching headers for the images returned by pic.php might work - or not, because there are URL parameters?
Häh!??????

Telling the browser to cache images and just returning "Not Changed" instead of the image on a new request would lessen the load on the server and maybe partly solve the problem - if the image is already in the browser cache.
Hi Martin,

I've chosen to combine your idea
mvlcek Wrote:the thumbnail/image exists, link to the image file.
with my previous
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 (!file_exists($thumbdir.$outfile) || @filemtime($thumbdir.$outfile) < @filemtime($imagedir.$infile) || isset($_GET['php'])){
  $link = i18n_gallery_site_link().'plugins/i18n_gallery/browser/pic.php?g='.$gallery['name'].'&p='.urlencode($item['filename']).'&w='.$tw.'&h='.$th.($tc?'&c=1':'');}
  if ($echo) echo str_replace('&','&amp;',$link); else return $link;

}
So automatically it will generate new thumb if not exist or old. SAme as you do in pic.php.
And the point at hostingsociety seems to be that it doesn't accept the huge number of calls of a php file.
This solution just works for the audience. The admin still have the problem that in edit or imagebrowser mode you're blind (just a few admin thumb are displayed). Not a big issue as I administrate my CMS locally.

Finally I think the only solution is to modify pic.php to make it a function and include pic.php only once woth a call to the function for each image/thumb.

mvlcek Wrote:On request of the page with the gallery the plugin knows the sizes and could resize all images not yet resized and then output links to these resized images/thumbnails. However, for a gallery of more than a few images this would take to much time and would probably give you a timeout.
As mentioned I've the feeling that the number of calls for the pic.php is the problem.

Quote:I have a not-yet-finished plugin similar to frontend-users, where you can define user groups based on the tags/keywords of pages and images, e.g. anonymous users see all pages/images tagged with "public", registered users get all pages/images unless tagged "private" and users in the group "friends" get all pages/images.

This was not what was looking for. I need more different groups (like family, friends, team, colleagues, etc) with different permission. But no issue as I found my own solution.


Quote:Telling the browser to cache images and just returning "Not Changed" instead of the image on a new request would lessen the load on the server and maybe partly solve the problem - if the image is already in the browser cache.
Again. It seems to be the call of pic.php. So if you need to call pic.php to compare the cache it won't work. If the cache is that smart that it reduces really the number of calls fine.
I'll report my studies to the coder of hostingsociety. I'll keep you updated.

bydey
dey Wrote:
Quote:I have a not-yet-finished plugin similar to frontend-users, where you can define user groups based on the tags/keywords of pages and images, e.g. anonymous users see all pages/images tagged with "public", registered users get all pages/images unless tagged "private" and users in the group "friends" get all pages/images.

This was not what was looking for. I need more different groups (like family, friends, team, colleagues, etc) with different permission. But no issue as I found my own solution.

This was just an example: you can define what an anonymous and a registered user will see and define any number of groups based on the tags, then assign those groups to registered users.
Number of images in a row is too great for the div size

Hi. I have a problem where the number of images in a row is too great for the div size, and as a result the last image is wrapping, leaving a single image in it's own row (next row is the start of the next row of images). Teh gallery is set to fancybox. The problem can be seen here http://216.172.180.17/~hewit/?id=gallery (temporary url).
I can work around this by changing the thumbnail size but the thumbnail is then too small.

Any ideas anyone? Seems the calculation for number of images per row is getting the container size from somewhere different to the final container.

Gallery call syntax is simply (% gallery name=gallery %)

Thanks
Trafford
trafford Wrote:Number of images in a row is too great for the div size

Hi. I have a problem where the number of images in a row is too great for the div size, and as a result the last image is wrapping, leaving a single image in it's own row (next row is the start of the next row of images). Teh gallery is set to fancybox. The problem can be seen here http://216.172.180.17/~hewit/?id=gallery (temporary url).

There is no computation of the number of images, all thumbnails use float:left.
As your thumbnails have different heights, this results in moving one thumbnail only under the last (height 73 instead of 75).
mvlcek Wrote:
trafford Wrote:Number of images in a row is too great for the div size

Hi. I have a problem where the number of images in a row is too great for the div size, and as a result the last image is wrapping, leaving a single image in it's own row (next row is the start of the next row of images). Teh gallery is set to fancybox. The problem can be seen here http://216.172.180.17/~hewit/?id=gallery (temporary url).

There is no computation of the number of images, all thumbnails use float:left.
As your thumbnails have different heights, this results in moving one thumbnail only under the last (height 73 instead of 75).

Thanks mvlcek. As you say, when I remove the bigger image, or set the image max, the issue is resolved.
Cheers, Trafford
Hello, I would like to know if I can create a gallery of video files (MOV, Vimeo, etc.?) using the Gallery plugin I18N Gallery? I know that the plugin is in a pretty photo library. The official website PrettyPhoto appears that there is such possibility.
Hello,
How to display a list of galleries with their names and 1 photo thumbnails?
egger Wrote:Hello,
How to display a list of galleries with their names and 1 photo thumbnails?

where do you want to display that, in a page or in the admin area of the plugin?
Connie Wrote:
egger Wrote:Hello,
How to display a list of galleries with their names and 1 photo thumbnails?

where do you want to display that, in a page or in the admin area of the plugin?
in a page called "List of Galleries"
egger Wrote:in a page called "List of Galleries"

there is no automatic list of galleries, but you can create your own list with links to galleries and thumbs

see here: http://mvlcek.bplaced.net/get-simple/i18ngallery

"Add a link to a gallery by adding the following to your page:

(% gallerylink name=my-gallery-name url=my-gallery-slug thumb=0 %)

(omit thumb to output the title instead of a thumbnail or use thumb=random for a random thumbnail)"