Tidypics images gone

I have used Tidypics 1.8.6 with Elgg 1.8.13 for four years without problem. Following move to a new server several albums have lost their photos. The captions and  comments are still there. Have searched everywhere on my site but cannot find where Tidypics stores the uploaded images. The path from any image present or missing points to a folder called "photos" off the main Elgg folder but no such folder is there.  It's a mystery. Any help appreciated.

  • The images of Tidypics are saved in the data directory of your Elgg installation in the users' subdirectories within. On Elgg 1.8 the data directory struture to a user's files is

    /path/to/datadirectory/<year>/<month>/<day>/<user_guid>

    with the date of the join date of the user (account creation) used in the path.

    Tidypics then creates the subdirectory "image" within a user directory and saves the images in yet another subdirectory with the album's guid as name. So, check for an album directory for which the images are missing in

    /path/to/datadirectory/<year>/<month>/<day>/<user_guid>image/<album_guid>

    If the images are missing after a server move, there could be several reasons why:

    • incomplete migration of the data directory (check if the files of an album not showing the images are there),
    • wrong file/directory permission for these files in the data directory (again check for image files not showing up and compare with images showing up),
    • then there could be a database entry of Elgg core not having been updated correctly after the server migration. But I would think that in this case no images at all would show up instead of just some. And it would also only be relevant if any of the paths have changed at all. See http://learn.elgg.org/en/stable/admin/duplicate-installation.html#database-entries for the database entries involved to find out if any of the entries (also the filestore::dir_root entry) might have to be changed.
    • Some more reasons why images don't show up are listed at http://learn.elgg.org/en/stable/appendix/faqs.html#no-images. The first two would be relevant with no images showing up at all. But the timezone set on the server might be relevant if it is different (or not set at all) on the new server compared to the old one. As the time/date is part of the path to the image files on Elgg 1.8 this might cause some images not to show up as Elgg looks in the wrong path.

    I would suggest to first check if the files are there in the data directory. If they are, you can try out what I have suggested for gettting them to show up again. If they are not there, they got lost in the server migration somehow and you would need to get them restored somehow first (backup?).

  • Hi again iionly. Sorry to be troubling you again with another server move problem - hadn't realized you wrote this plugin.
    Anyway I've confirmed all images are on the server and that folder and file permissions are identical for images that show and those that don't. Don't quite see why there's no folder for 2017. Images uploaded by a user two days ago are in the 2016 folder. They show normally.

    There has been no change in paths within the Elgg folder. The only change I'm aware of was when I modified the site url to https:// from http:// and checked "Enable HTTPS logins" in Advanced settings as I now have SSL (reason for changing server).

    Incidentally a number of user icons also no longer show, including for those users whose album photos don't.

    I will check about the server time with my provider. I really don't want to change those database entries as I know very little about Sql.

  • The years folders are created "on demand". If a member on your site who registered the account in 2017 would upload a file / avatar image the 2017 folder would get created with the corresponding subfolders within for saving the uploaded file(s) there.

    If paths are the same and the image files are there AND it's not only the Tidypics images but also profile images (or most likely any kind of files saved in the data directory) that don't show up for some users - but not all - I would guess it's a timezone issue. In case you ever upgrade from Elgg 1.8 to a newer Elgg version you won't have this problem anymore as the structure of the data directory is different then (all files and directories will be migrated during the upgrade to 1.9). Nevertheless, a correct timezone set on the server will be useful as the posting date is of course still depending on the time on the server at the time of posting the content.

  • I just got this reply from my hosting company:

    "The timezone are not the same. On the new server is UTC and the old server is UTC -5 hours."

    The server is in Montreal Canada, (I'm on the Pacific coast) so I guess its adjusted to GMT or western Europe.

    The five hour difference shouldn't matter from now on as most of my users are in the UK. But Is there anything I can do  to display those "missing" images now we know what caused the glitch? 

  • Sorry, my mistake. UTC - 5 is Montreal time (Eastern Daylight Time).  UTC is same as GMT. If I deleted the folders in question then put them back five hours later, would that fix it? (Probably a silly question but its late!)

  • iionly - I just found a link with advice (including yours) for changing server timezone in Elgg. https://elgg.org/discussion/view/2412154/how-do-i-change-the-time-zone-settings

    Am wondering, if I make this script change will it effect the one album created successfilly since the server change (UTC)? Also, am I right in thinking it will not affect entries made prior to server change  (UTC -  ?

  • To be honest, I can say for sure if the images of the newly created album will show or not after changing the timezone. My guess is, yes, as I think the real cause of the images not showing (actually any kind of files of the affected users not found) is the <day> part in the path to the users' data:

    /path/to/datadirectory/<year>/<month>/<day>/<user_guid>image/<album_guid>

    These (sub)directories are created with the timestamp of the account creation taken into account. And the <day> can be different due to the timeshift of different timezones. Afterwards on accessing any files again Elgg again takes the timezone / timeshift currently used into account when determine the path the files are to be found. This part can fail when the timezone has changed.

    My suggestion: just try setting the timezone to the timezone used on the old server either in Elgg's .htaccess or in engine/settings.php as soon as possible. The crucial point isn't necessarily the one new album but rather the old albums and profile pictures: will these show up again? If yes, you might lose one new album. But I think it's much easier to fix that (upload again) as compared to trying to get all the old stuff showing up again with different users involved. Also, trying as soon as possible is important as you might get a problem with any newly created accounts now with the new timezone in effect once you return to the old timezone.

    Just ask the support of your webhoster about the name of the timezone used on the old server and the add either a line in the <IfModule mod_php5.c> block in .htaccess like

    php_value date.timezone 'UTC'

    with the timezone name you were told instead of UTC. Or add a line like

    date_default_timezone_set('UTC');

    in engine/settings.php before the line

    global $CONFIG;

    Again, enter the timezone name actually been used on your old server.

  • Eureka - it worked! I entered: date_default_timezone_set('America/Montreal'); in engine/settings.php and the missing images now display correctly. Also, the album created post server move and its comments and the two new user registrations have not been disturbed.

    Once again I'm most grateful to you for getting my site working again.  I'll doubtless be upgrading later this year and hope you guys hang together (have been reading some of the debate!). Although complex for a non coder like me, I have found Elgg to be consistently highly stable, flexible and secure and look forward to installing version 2.3.