Lightbox Gallery Resource

Re: Lightbox Gallery Resource

by Paul Holden -
Number of replies: 17
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
I've posted another updated version of the plugin on the site big grin

This version includes a plugin-based image editor which allows you to edit images contained within your lightbox galleries. Default image editing plugins include:
  • Resizing
  • Cropping
  • Rotating
  • Flipping
Gallery image cropping

Gallery image resize

There are also plugins included that allow you to add captions to individual images (one of the more popular requests...) which will be displayed when viewing images full size through the lightbox effects, and a basic thumbnail editor. The image editor can be accessed by the Turn editing on button displayed at the top of a gallery, and requires mod/lightboxgallery:edit capabilities for a user.

There's some code enhancements in the plugin too, particularly in the image resizing and thumbnail generation - they should be sharper and better proportioned now. If you want to generate new thumbnails for existing galleries, you should navigate through the file manager to the image directory and delete the _thumb directory contained within.

If you're upgrading from a previous version remember to skim through the install.txt file for upgrade instructions!

Modules & Plugins Entry
Lightboxgallery Homepage

Paul
In reply to Paul Holden

Re: Lightbox Gallery Resource and IIS

by Steven Roberts -
Hello Paul

Could you tell me if there is a problem with the Lightbox Gallery with Moodle running on a Windows 2003 Server and IIS. The thumbnails do not display all I have is the red cross?

Many thanks

Steve
In reply to Steven Roberts

Re: Lightbox Gallery Resource and IIS

by Paul Holden -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Steve,

What is the path of the thumbnail when viewing your gallery? E.g. <img src="?" /> Do the fullsize image appear when clicking on the thumbnails?

Cheers,

Paul

In reply to Steven Roberts

Re: Lightbox Gallery Resource and IIS

by Mike Forshaw -

Hi,

My thumbnails only appear as red crosses and the image won't display when you click on them. I have tried renaming the pictures to something else with no spaces or special characters then re-uploading but that doesn't make a difference.

I have version 1.8.3+ of Moodle and have dowloaded the latest lightbox version.

Any help would be great,

Thanks,

Mike

In reply to Paul Holden

Re: Lightbox Gallery Resource

by Charles Applegate -

Hi Paul, great work on this- some excellent features!

However, I've upgraded to this version, and when I try to add a caption or do an crop/flip etc, I get a message saying "The requested file was not found". The upgrade has simply written over the existing folder. The admin notifications page said the tables were updated fine. I'm logged in as Admin, versino 1.8.2+

Any ideas? Thanks,

Charles.

In reply to Charles Applegate

Re: Lightbox Gallery Resource

by Paul Holden -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Charles!

The requested image filename is grabbed and filtered with PARAM_CLEANFILE, so all non-safe/standard characters (according to Moodle...) will be stripped out - this includes spaces. All files that are uploaded to courses should have had there filename already filtered through this same procedure, but if some other upload method was used I guess that might not be the case.

Let me know if renaming the image fixes it smile

Paul

In reply to Paul Holden

Re: Lightbox Gallery Resource

by Charles Applegate -

Hi Paul, thanks for getting back to me. The old upload chesnut has done it again! Yep, it seems that spaces in file names are an issue. That does allow me to add a caption and use the other features.

The 'crop' feature doesn't seem to work though- all I get is a black image with the 4 control squares in the top left hand corner of the image, and they can't be moved. Any ideas? No pressure, I'm not using it at the moment, but just noticed it.

Thanks again for your continuing work on one of the best modules in Moodle smile

Charles.

In reply to Charles Applegate

Re: Lightbox Gallery Resource

by Andy Tagliani -
Hi Paul

I get these error warning (in the debug mode) and have a blank_page on moodle 1.8.3

Warning: Invalid argument supplied for foreach() in /srv/www/xxxxx/xxxxx/wwwroot/moodle/mod/lightboxgallery/view.php on line 85

Fatal error: Call to undefined function exif_read_data() in /srv/www/xxxxx/xxxxx/wwwroot/moodle/mod/lightboxgallery/lib.php on line 266

Bye Andy
In reply to Andy Tagliani

Re: Lightbox Gallery Resource

by James Ballard -

Warning: Invalid argument supplied for foreach() in /srv/www/xxxxx/xxxxx/wwwroot/moodle/mod/lightboxgallery/view.php on line 85

This appears if you have no comments yet. Try this to check if there are comments first (approx lines 131-34 in view.php):

if ($comments) {
foreach ($comments as $comment) {
lightboxgallery_print_comment($comment, $context);
}
}


Fatal error: Call to undefined function exif_read_data() in /srv/www/xxxxx/xxxxx/wwwroot/moodle/mod/lightboxgallery/lib.php on line 266

exif_read_data only accepts JPG and TIFF formats. I think you can try filtering this (approx lines 267-273 in lib.php):

if (exif_imagetype($file) == IMAGETYPE_JPEG || exif_imagetype($file) == IMAGETYPE_TIFF_II || exif_imagetype($file) == IMAGETYPE_TIFF_MM) {
$exif = exif_read_data($file, 0, true);
if (isset($exif['IFD0']['DateTime'])) {
$date = preg_split('/[:]|[ ]/', $exif['IFD0']['DateTime']);
$timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]);
}
}

The function in question refers to a modified date, which may be possible to take from Moodle instead. There is a date associated with each image so I am not sure if this is redundant.


I get the following error if I try to do anything with editing on (add caption, crop etc.):

Error output, so disabling automatic redirect.

Captions still work despite this, however thumbnail editing wasn't.

In 1.9 there is also a problem with the print_header function since these changes, trying to get my head around them too for my own modules:

print_header() was sent a string as 3rd (Test Course -> Lightbox Galleries -> Image Gallery -> Edit image) parameter. This is deprecated in favour of an array built by build_navigation(). Please upgrade your code.
  • line 2299 of lib\weblib.php: call to debugging()
  • line 34 of mod\lightboxgallery\editimage.php: call to print_header()


Yours
James
In reply to James Ballard

Re: Lightbox Gallery Resource

by Andy Tagliani -
Hi James

Thanks for your help James, not the same, but problems always exist. If i modify the view.php like your posting, the images will only show in the edit mode ...

My question is, in my php editor the lines are a little different to your posting. See my line beginning from line 130 to 134

foreach ($comments as $comment) {
lightboxgallery_print_comment($comment, $context);
}
}
}

Thanks
Andy
In reply to Andy Tagliani

Re: Lightbox Gallery Resource

by Andy Tagliani -
Here german language files for version 1.2 of the lightbox gallery.

Andy
In reply to Andy Tagliani

Re: Lightbox Gallery Resource

by Paul Holden -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Andy,

The first error (invalid argument for foreach...) can be solved by modifying the following lines in view.php:

$cobjs = get_records('lightboxgallery_captions', 'gallery', $gallery->id);
$captions = array();
foreach ($cobjs as $cobj) {
$captions[$cobj->image] = $cobj->caption;
}

Change to:

$captions = array();
if ($cobjs = get_records('lightboxgallery_captions', 'gallery', $gallery->id)) {
foreach ($cobjs as $cobj) {
$captions[$cobj->image] = $cobj->caption;
}
}

The second one (Undefined function exif_read_data...) needs the following fix in lib.php, about line 266:

if ($exif = exif_read_data($file, 0, true)) {

Change to:

if (function_exists('exif_read_data') && $exif = exif_read_data($file, 0, true)) {

This code reads meta data attached to the image, which records things like the camera/model used to take the picture, ISO, copyright, and the date the picture was taken. This date is returned if available, otherwise it defaults to the last time the image was modified.

Paul

P.S. Thanks for the translation!
In reply to Paul Holden

Re: Lightbox Gallery Resource

by Andy Tagliani -
Yes Paul

Thats it! Thank you very much, if there any changes in the language files, let me know, here or send me a shot message over moodle here.

Andy
In reply to Paul Holden

Re: Lightbox Gallery Resource

by Richard Heath -

Hi,

I just installed this on 1.8.2+ and had the same error messages (lines 85 & 266). The mods did the trick. Thanks very much. Great mod, by the way!

In reply to Charles Applegate

Re: Lightbox Gallery Resource

by Higor Vaz -
Hello Moodle loversboca aberta, this is really a great mod!!!
Im with the same problem noticed by Charles, the Crop, Rotate and other functions dont work. Only Caption works.
Using 1.9.4+ tested with FF3 and IE7. Thanks,
Higor. higorvaz@gmail.com
In reply to Charles Applegate

Re: Lightbox Gallery Resource

by Mariam Mahmoud -
Hi,

Did you solve the black color issue?

Regards,
Mariam
Attachment capture.JPG
In reply to Mariam Mahmoud

Re: Lightbox Gallery Resource

by Mariam Mahmoud -
Black image issue sloved.
The lightbox gallery folder contains 26 files only 20 were extracted and uploaded.

Regards,
Mariam
In reply to Mariam Mahmoud

Re: Lightbox Gallery Resource

by ros bowstead -

I created one gallery which shows fine but when I try to create a secondI am having the same issue with the gallery all images are showing black, when I try to upload an image it states that I have not selected an image but I clearlyhave. Any help gratefully appreciated.