SMOLNET PORTAL home about changes

moving files directory in Drupal

I’ve a multisite installation of Drupal x, a modified Garland theme and user pictures (avatars) enabled. Till now, I used a single “/files” directory for all sites…yes, it sounds freaky (and it’s). I want to enable image upload, so now I want to create something like “files/my1stsite” without Drupal explodes. How to do that?

If you have enabled CSS compression in admin/settings/performance, disable it Copy (not move!) the user picture folder (i.e. avatar) to “files/my1stsite”. Note: you have to make files and folder writable, if they aren’t: if you omit this step, users cannot change their avatar. (recommended) Put your site offline to prevent changes. Change manually all the user pictures path on the database table drp_shared_users, field “picture”. Before: files/avatar/picture-… After: files/my1stsite/avatar/picture-… Existing users images now are taken from the new folder. Go to admin/settings/file-system and set the new system path (i.e. “files/my1stsite”). Now even new users pictures go in the new folder. Go to admin/user/settings, verify the users pictures path and save. Go to admin/build/themes/settings/garland and save. It’ll create a “color” folder in the new system path, regenerating the theme. If you use image cache, you have to go to admin/settings/imagecache and update all your presets. Check any other module that uses the files directory. Put online your website. Now you can reactivate CSS compression.

image cache (http://drupal.org)


Use this tutorial at your own risk.

Important: if you have a shared user table, avatars will be only visible in the site where users uploaded them~~, due to the (questionable?) choice to store a relative path in user tables~~.

UPDATE: to solve the latest problem, you’ve to patch user.module:

Old string:

$picture = file_create_url($account-\>picture);

New string:

\#patch to multisite user picture de-linked

$picture = $account-\>picture;

If you use site user list, you’ve to change on admin/settings/site_user_list/fields the template value from:

site user list (http://drupal.org)


\<img src=”@\_base/@picture” alt=”” /\>

to:

\<img src=”@picture” alt=”” /\>

suppressing @\_base value. Note: giving an “alt” value is good for accessibility, so do it. You can also link user profile wrapping image in a “\<a href=”user/@uid”\>” or “\<a href=”user/@name”\>” (if you use URL rewrite).

https://web.archive.org/web/20071011000000*/http://drupal.org/project/imagecache (https://web.archive.org)
https://web.archive.org/web/20071011000000*/http://drupal.org/project/site_user_list (https://web.archive.org)
Response: 20 (Success), text/gemini
Original URLgemini://chirale.org/2007-10-11_737f5d08859847ebd134c77c7...
Status Code20 (Success)
Content-Typetext/gemini; charset=utf-8