We were using a symlink – but it doesn’t support renaming files.
So we went with a every 1 minute cronjob instead.
The reason for all this was trying to keep the uploads folder synced across multiple servers.
So image processing will stay on server X, cronjob will pull all files to CDN, and all display calls will be routed to CDN.
The avatar code is in bp-core/bp-core-avatars.php.
The cropping is jquery, so I would look for the avatar files with the label “.js”
There aren’t any avatar js files. The avatar code is output in the section of the html. The bp-core/bp-core-avatars.php file handles the actual cropping and saving of avatar files.
The cronjob approach didn’t work either.
So, the basic issue is still trying to keep the uploads folder synced across multiple servers.
If anyone has encountered this, please advise.
Rackspace server support is now suggesting
-local replication with rsync with persistence on the load balancer
or
-NFS (real-time synchronization)
The crop code is a bit hidden, but after upload, it stores the image somewhere in wp-uploads. After the crop, it deletes that original and saves the crop. If I get time at work, I’ll look up the path (you could just view the img src for an avatar that has been uploaded.
The easiest way I see would be sync directories across the servers, but that’s not without its own issues (sounds like you’ve found some of them). We did have a plugin somewhere that put avatars onto S3; that would be the approach I might take in this situation. I’m not sure if that plugin was ever released publicly.
This is all new to me, but I think what is happening is that all file uploads are sent to CDN (Cloud Files). But BP does file operations (copying and creating thumbs, etc), on the file in the uploads dir, but the new files are not uploaded to CDN. The original file is deleted as it should be but on a display call the avatar shown is the default avatar because the call looks in CDN for a file that was never uploaded.
One approach might be to do the operations and then, in bp-core-avatars.php, upload to CDN.
But this isn’t just about avatars, it’s everything in the uploads folder.
So any subsequent operations would require getting the file from CDN rather than uploads, doing operations and then putting it back into the CDN. Not sure if this would work and if it did wouldn’t it waste bandwidth and increase time significantly.
Paul – any info you have re avatars to S3 would be appreciated, especially re GD operations on avatars.
Items other than avatars are likely not to do with WordPress, so it may be worth broadening your search efforts to look for multisite-specific techniques. As far as I can tell, the s3 avatar upload code was never released publically (or if it was, I can’t find it)