Compatible XF Versions:
1.0
1.1
1.2
1.3
1.4
Some useful info about attachments/fotos in Xenforo:
Where are attachments stored?
If you were used to vBulletin there was a setting if you want to store the attachments in the file system (doesn't stress your database) or in the database (prohibits synchronization problems if you use several servers).
Xenforo stores them solely in the file system.
How are the files organized?
vBulletin used the userid for the structure of the directories. In Xenforo its slightly different:
The directory for the avatars are based on the userid, for all other attachments a sequential number is generated, the attachment id, a number which shows up also in the file name.
location for attachments: internal_data/attachments
location for thumbnails: data/attachments
You can change this path in config.php:
$config['internalDataPath'] = 'new_internal_data_path';
To both types of attachments applies: for every 1000 files a new directory is created. Attachments with id 0-999 can be found in directory 0, id 1000-1999 are in directory 1 and so on....
How are the attachments linked to content (database tables)?
xf_attachment is the link between content (post) and attachment, it also contains the date and the number of views
xf_attachment_data is the link between user and attachment and also contains file name, file size, thumbnail size
xf_attachment_view is a memory-based table used for storing view data.
Important info for photo communities:
The problem:
If you set the "Maximum Attachment File Size" too small (e.g. the default 1 MB) your users are frustrated because a typical photo today is larger and they get an error message. Then they either give up or use one of the online picture tools
If you use a higher setting (e.g. 10 MB) the users are happy because they can upload all their photos, but now the admin has a problem due to increased disk space usage, increased backup time, increased traffic
The solution:
Set the "Maximum Attachment File Size" to something useable (e.g. 10 MB)
Set "Maximum Attachment Image Dimensions" to e.g. 800x600 pixels or 1200x1000 pixels
This way the users are able to upload large photos but Xenforo automatically resizes the photo after the upload to the maximum dimension!
An example:
Photo xyz.jpg
File size 4 MB
Original: 2816x2112 = 5.947.392
Maximum set to 1200x1000 = 1.200.000
Photo will be resized to 1200x900 and uses only 350 KB.