image.module issues FAQ ========= Created: 17 Mar 2008 Last changed: 17 Mar 2008 Image versions: image 5.x-1.x, 5.x-2.x-dev, 6.x-1.x-dev ---------- Includes: 1) Memory issues. White screens of death, 500 errors and the like. 2) upgrade troubles. old image table, mysql < 4.1 woes, file path problems and the like. 3) Gallery sorting. Patch available. 4) Images in different directories. ========= ---------- 1) Memory issues: ---------- try to add this to your settings.php ini_set('post_max_size', '10M'); ini_set('upload_max_filesize', '10M'); ini_set('memory_limit', '24M'); ---------- 2) Upgrading from image 5.1.6 to a newer version ---------- a) the new image table: ---------- If you upgraded from 4.x straight to 5.1.7+, you already had an image table - but it was different from the one used in 5.1.7+. This will make your upgrade fail, and the update.php run won't do the things it's supposed to. To fix this, you can do these particulars yourself: For MySQL: Delete the old table (adjust the table name for your prefix): DROP TABLE `image`; (Or, if you feel insecure about dropping a table, rename it:) ( RENAME TABLE `image` TO `image_tmp`; ) Create the new table (adjust the table name for your prefix): CREATE TABLE `image` ( `nid` int( 10 ) unsigned NOT NULL , `fid` int( 10 ) unsigned NOT NULL , `image_size` varchar( 32 ) NOT NULL , PRIMARY KEY ( `nid` , `image_size` ) , KEY `image_fid` ( `fid` ) ) DEFAULT CHARSET = utf8; Then, rerun update 5200 for image, to populate your image table and remove your image data from the file_revisions table. ---------- b) MySQL version < 4.1 ---------- (http://drupal.org/node/208785 - patch in sight, after user testing) If you run a version earlier than 4.1, the SQL command used in image's update #4 and #5200 ("EXISTS") won't work, and you'll get an SQL error when you run update.php. I) image update #4 throws an SQL error. Removing {files} with duplicate filenames: Instead of this: SELECT f1.fid, f1.nid, f1.filepath FROM files f1 INNER JOIN node n ON f1.nid = n.nid WHERE n.type = 'image' AND EXISTS ( SELECT * FROM files f2 WHERE f2.filepath = f1.filepath AND f1.fid <> f2.fid AND f1.fid < f2.fid ) (and DELETE FROM files WHERE fid = ...) Run this: DELETE FROM `files` f1 LEFT JOIN `files` f2 ON f1.fid = f2.fid INNER JOIN `node` ON f1.nid = node.nid WHERE f2.filepath = f1.filepath AND f1.fid <> f2.fid AND f1.fid <> f2.fid Cleaning up the file_revisions table isn't critical, but if you wish to do it by hand you can do so. Instead of this: DELETE FROM file_revisions WHERE NOT EXISTS (SELECT * FROM files WHERE files.fid = file_revisions.fid) You can run this: DELETE FROM `file_revisions` LEFT JOIN `files` ON file_revisions.fid = files.fid WHERE files.fid IS NULL; II) image update #5200 throws an SQL error. Cleaning up the file_revisions table isn't critical, but if you wish to do it by hand you can do so. Instead of this: DELETE FROM file_revisions WHERE EXISTS (SELECT * FROM image WHERE image.fid = file_revisions.fid) Run this (on MySQL): DELETE FROM file_revisions USING file_revisions, image WHERE image.fid = file_revisions.fid; ---------- c) file paths: ---------- I) image update 4 doesn't always run; it adds /files/ in front of /images/, in files.filepath. To fix that, try to run this bit of SQL on your MySQL database: UPDATE files SET filepath = CONCAT('files/', filepath) WHERE filepath LIKE "images%"; (or UPDATE files SET filepath = REPLACE(filepath, 'images', 'files/images') WHERE filepath REGEXP '^images'; ) II) Private files: in order to run your files as "private", you need the full path in files.filepath. (explanation + snippet from http://drupal.org/node/184489#comment-615875) Adjust things to match your path in below SQL snippet, then run it on your database. Also adjust your default "images" directory, if it's not "images". UPDATE files SET filepath = concat('/drupal/file/system/path/', filepath); WHERE filepath LIKE "images%"; ---------- 3) Gallery sorting. Patch available. ---------- http://drupal.org/node/21037 #16: 5.x-1.7 / 08 Mar 2008 #19: 5.x-2.x-dev / 10 Mar 2008 #20: 6.x-1.x-dev / 10 Mar 2008 ---------- 4) Images in different directories. ---------- http://drupal.org/node/228640 Half a patch, half of it is missing. / 02 Mar 2008 http://drupal.org/node/103793 Lots of discussion, no patch in sight.