[Elgg 1.5-1.12 & 2.X - 5.X: Tidypics] v1.10.8

Release Notes

  • Updated Plupload HTML5/HTML4 uploader to version 2.1.8,
  • New plugin setting to define maximum number of images allowed to be uploaded in one batch,
  • New plugin setting to set the forward of the site menu entry ("All photos" or "All photo albums"),
  • New plugin setting for perfoming some optimizations on creation of image thumbnails that should result in smaller filesize. Works only with ImageMagick command line tools used as Image library,
  • "is_trusted" attribute added to navigation arrows (previous/next image) when viewing an image,
  • extract GPS location data from images on upload if available (location data is not yet used by Tidypics itself but it is of use in case you use the jssor slideshow plugin available at https://elgg.org/plugins/2272330),
  • New tool on "Delete image" tab of Tidypics plugin settings to allow searching for and deletion of image entries that have no longer their image files in the data directory (e.g. part of data directory got lost). Use with this tool with care!!!
  • ah great, thanks - i have noticed that there are some images that fit the description of the last point here.. i'm not sure how they they end up that way, but at least now i can remove them.

  • i just tested the image optimisation locally and on my test image i saw a 20% reduction in filesize for thumbnails using the complex method and no obvious visible degrading of image quality.

  • @ura soul

    There are two possible reasons for missing image files. Either there was an error on creation of the thumbnails already during the image upload (to remove such image entries there's already a tool available in Tidypics). The new tool might also work here (though I've not tested this use case). The new tool is aiming more on the case of lost image files (or part of the data directory) for example due to a server migration or server crash. If restoring the lost files using a backup is not possible, the new delete tool helps at least to get rid of the now useless image entries.

    I hope that the reduced file size of thumbnails when using the optimizations will not be noticeable (I have chosen rather conservative - i.e. high - quality settings). But it depends on the image sources to a certain extend (and the expectations of the users). Unfortunately, there's no magic trick to reduce filesizes without some compromises.

  • ok, i see. i have just noticed that the thumbs for an animated gif that was produced via the new code (complex option) has been corrupted. most of the pixels are white, with some coloured ones. this is the original image: http://i.imgur.com/0Hr1EZS.gif

  • Sometimes it helps to feel challenged. :-)

    I had noticed in the past (independently of any resize optimizations) that some animated gifs were okay after resizing and for others it looked like with the example image you have linked. I blamed the original images to already be not fully okay resulting in the artefacts. But it seems it's possible to get them to get resized correctly with some additional parameter (to be used with gifs only).

    Try it with

        $gif_to_convert = ($imgsizearray['mime'] == 'image/gif') ? '-coalesce' : '';

        // see imagemagick web site for explanation of these parameters
        // the ^ in the resize means those are minimum width and height values
        $thumbnail_optimized = elgg_get_plugin_setting('thumbnail_optimization', 'tidypics');
        switch($thumbnail_optimized) {
            case "complex":
                $command = $im_path . "convert \"$input_name\" ".$gif_to_convert." -filter Triangle -define filter:support=2 -thumbnail ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." -unsharp 0.25x0.25+8+0.065 -dither None -posterize 136 -quality 82 -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace none -colorspace sRGB -strip \"$output_name\"";
            case "simple":
                $command = $im_path . "convert \"$input_name\" ".$gif_to_convert." -quality 87 -filter Lanczos -thumbnail ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";
                $command = $im_path . "convert \"$input_name\" ".$gif_to_convert." -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";

    in the function tp_im_calc_resize_params() in the file tidypics/lib/resize.php. I guess I will include this adjustment in the next release of Tidypics then.

  • hehe.. ok.

    i am looking at the source of that file and am not sure i know where to put the code you have pasted here. e.g. there is no $command variable in the function that you have said to paste this into - so this code will have no effect.

  • @ura soul Sorry. I got the function name wrong. The change has to be made in the function tp_im_cmdline_resize() (still in the file tidypics/lib/resize.php). There's a switch/case-statement beginning at line 448. Before this switch-statement you would have to add the line

    $gif_to_convert = ($imgsizearray['mime'] == 'image/gif') ? '-coalesce' : '';

    and then add


    after "$input_name\" in the 3 cases. The changed code is the bold part in my last posting.

  • oh ok - well i did that and the thumbnails failed to generate.

    i see this in the log:

     "exif_read_data(phpKMFh3K): File not supported" in file /mysite/mod/tidypics/classes/TidypicsImage.php (line 206)

    Image Magick convert failed" in file /mysite/mod/tidypics/lib/resize.php (line 466)

    failed to create thumbnails - ImageMagick command line" in file /mysite/mod/tidypics/classes/TidypicsImage.php (line 458)"

  • The exif_read_data() issue shouldn't be connected with the conversion failing. gifs have no exif data and the retrieval of exif data happens independently from the conversion. I might need to add a check though to prevent Tidypics from trying to read exif data for gifs in the first place.

    The failure of conversion might be connected with the changes not made correctly in resize.php. You need to make sure that you insert

    " . $gif_to_convert . "

    with the double quotes included, e.g.

    $command = $im_path . "convert \"$input_name\"   " . $gif_to_convert . "   -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";

    Also the dots before and after $gif_to_convert are important.

  • yes, that's how i inserted the code.

  • And you've also added the addtional line before that assign the value to $gif_to_convert? Another possible reason for failure would be usage of an old version of ImageMagick (I don't know when the -coalesce option was introduced). Or it might be a memory or timeout issue (though it shouldn't take that long to create the resized images).

  • yes, i inserted the other line first.

    i just looked in the admin area for tidypics and saw that it lists that imageMagick is disabled.. i'm not sure why that is.

    i ran the test for the imageMagick path and it returned this:

    Version: ImageMagick 6.8.8-10 Q16 x86_64 2015-03-10 http://www.imagemagick.org Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC Features: DPC Modules OpenMP Delegates: bzlib cairo djvu fftw fontconfig freetype gslib jng jpeg lcms ltdl lzma openexr pangocairo png ps rsvg tiff webp wmf x xml zlib

  • This version should be fine. But if ImageMagick is listed as disabled it might be the wrong path to the executables entered on the settings page (if path seems correct try adding a slash at the end if its currently not there). Wrong path / no path would also explain why the conversion is failing.

  • hmm.. there already is a slash at the end. the test button works ok using the same string that is being used to provide the path for use on the first tab in the admin panel. strange.

  • @ura soul Forget what I posted this morning. The server tab does not show the availability of the Image Magick command line tools but rather the availability of the GD and Imagick php extensions only. So, if you have entered the same path on the settings tab where Tidypics found the Image Magick commands  successfully, the creation of the thumbnails should work with Image Magick.

    You should restore the original resize.php as included in Tidypics version 1.10.8. Does it work then with the creation of thumbnails (not specifically the issue with animated gifs)? If it works with the original resize.php but not after modifying it I can only guess that you made either a mistake in changing the code or your server / Image Magick version doesn't support the additional parameter of the convert command. The principle support could be tested by doing a conversion with the same set of parameters from a shell for testing. If it works there it still might be an issue of memory (though I think unlikely) or you just have some error in the changed code.

  • this is what appears in my edited file:

     $gif_to_convert = ($imgsizearray['mime'] == 'image/gif') ? '-coalesce' : '';
        switch($thumbnail_optimized) {
            case "complex":
                $command = $im_path . "convert \"$input_name\"".$gif_to_convert." -filter Triangle -define filter:support=2 -thumbnail ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." -unsharp 0.25x0.25+8+0.065 -dither None -posterize 136 -quality 82 -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace none -colorspace sRGB -strip \"$output_name\"";
            case "simple":
                $command = $im_path . "convert \"$input_name\"".$gif_to_convert."  -quality 87 -filter Lanczos -thumbnail ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";
                $command = $im_path . "convert \"$input_name\"".$gif_to_convert." -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";

    when i revert the code back to the original version, i am back to how it was when i began - the jpg files work ok and the animated gif file is still broken.

    i don't have timespace available presently to test this further, but may do tomorrow.

  • @ura soul Try it with an additional space after "$input_name\"


    convert \"$input_name\"".$gif_to_convert."


    convert \"$input_name\" ".$gif_to_convert."

    Without this space the value of $gif_to_convert gets added to the input_name and it's wont get seen as separate parameter. This would only be a problem with gif images as the value of $gif_to_convert is '' for other image types. Also, after the double quote at the end of $gif_to_convert." a space is necessary to separate the following parameter.

  • ah yes, that was it.. the gif now displays fine :)

  • hi, because the posts the pictures are in this format? not together?

  • @Jaqueline The reason is that your site theme makes the content area smaller than it would be with the default Elgg theme (or bundled Aalborg theme). Or you have increased the thumbnail size in Tidypics settings (can't see from the picture if this might be the case). Anyway, for the image listing to look "nice" there are adjustments necessary either in the theme plugin's CSS file(s) or in Tidypics' CSS file. If an increase of the width of the content area in the theme isn't an option you would have to increase the width used to display an item within the album gallery view. You won't get 4 items in one row in any case as the content area is too small but increasing the width would at least result in three items per row evenly. The width to increase is the following one in the file tidypics/views/default/photos/css.php:

    .elgg-module-tidypics-image {
        width: 161px;
        text-align: left;
        margin: 5px 0;

    You can also include this css class definition in the CSS file of your theme and make the adjustment there. Then you wouldn't lose the change when upgrading Tidypics.

  • Hi, I have installed Tidypics Photo Gallery 1.10.8. I am running Elgg version 1.12.6

    Now, whenever anyone uploads a picture, it is shown as no image/white image. When I am trying to open the image by double clicking, it is showing as failed to upload. Please help

  • @ReaL It could be that saving the uploaded images to the data directory fails due to wrong permissions for the data directory. Does uploading and display of profile images work correctly and can you also upload files (maybe specifically an image file) using the bundled files plugin of Elgg?

    Or you might also need to increase post_max_size in .htaccess for the processing of uploaded images to work correctly (I read in one of your other postings that you increased memory_limit but you didn't mention post_max_size - btw a single posting would have been enough).

    Try uploading a single, small image first. Does it work? Check in the data directory (i.e. in the corresponding subdirectory of your account in the data directory) if the image and the thumbnails have been saved / created correctly. If these files are there, the uploading has worked correctly (so displaying the images is the problem). If the files are not there, something goes wrong on image upload (e.g. permissions of data directory).

    If the image and thumbnail files are correctly saved in the data directory but the images are not displayed on the site, the problem might be caused by another 3rd party plugin that causes some kind of conflict. Possibly some plugin is not compatible with Elgg 1.12.

  • it is possible to decrease the photo numbers on the river page: 7 for a smaller number?

  • @lorena The number of 7 images relates only to the river entry on creation of new albums (i.e. the first time you add images to a new album). To adjust the number you have to modify the file mod/tidypics/views/default/river/object/album/create.php. The line to change is

    $images = $album->getImages(7);

    Just change the 7 to the number of images you prefer.

    For image uploads to an album at a later time (and if you have configured the Tidypics plugin settings to show all images of a single upload in a single river entry) thumbnails of all images will be shown (up to the maximum number of 10 images allowed). If you want to reduce the number of thumbnails shown in these river entries you would have to modify the file mod/tidypics/views/default/river/object/tidypics_batch/create.php. Here you would have to add the line shown in bold in the following:

    // Get images related to this batch
    $images = elgg_get_entities_from_relationship(array(
        'relationship' => 'belongs_to_batch',
        'relationship_guid' => $batch->getGUID(),
        'inverse_relationship' => true,
        'type' => 'object',
        'subtype' => 'image',
        'offset' => 0,
        'limit' => 5,

    The maximum number of images would be 5 in this example but you can use the limit you prefer (10 or more makes no sense as the maximum number per upload batch is already limited to 10).

  • iionly I am returning to thank the solution of Tidypics settings now works perfectly as I want to thank


  • Category: Photos and Images
  • License: GNU General Public License (GPL) version 2
  • Updated: 2024-5-7
  • Downloads: 147573
  • Recommendations: 221

Other Projects

View iionly's plugins