Closed (fixed)
Project:
Image
Version:
6.x-1.x-dev
Component:
image_attach
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Apr 2009 at 19:46 UTC
Updated:
14 Sep 2009 at 17:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
escoles commentedThis seems to be a bug. See workaround posted here:
http://drupal.org/node/269225#comment-880496
On Drupal 6, after an initial install of image_attach, the block does not appear unless there is a value specified in the region field of the block's entry in the block table.
Manually editing the blocks table causes the block to appear.
If the block is subsequently disabled, it continues to be displayed on the Blocks page. You'll need to do a new clean install to see the problem.
Comment #2
joachim commentedYup, looks like there's a problem here.
In D5, _block_rehash() set defaults for region etc.
In D6, it doesn't.
Furthermore, it assumes that if we set status, we set region too:
which is not unreasonable.
Given that attaching nodes show their attached images anyway, I don't see the point of having the block enabled too -- surely you only need it if you've hidden the attached image in the node.
So the best and quickest fix is to remove the status = 1.
As you've found, there's no way to get Drupal to notice the block once it's stored in the DB in this bad state. So I've added an update function to delete it. Next visit to the blocks admin page will restore it to the database.
Please test the attached patch -- try it on any installation of image, new or old, and run the update script.
Comment #3
joachim commentedOn second thoughts, let's be sure to only delete that one block.
It may be that in the future this module has more blocks, and that a user only upgrades from the version before this fix to the version with more blocks in one go.
Comment #4
sp3boy commentedHi, just came across this in the course of testing the block functionality of #81102: Attach Multiple Images with image_attach using Drupal upload mechanism. The above patch in #3 works fine in making the attached images block accessible on the admin/build/blocks page.
I agree that the benefit of having a block for the attached images of a node that is already being displayed with its attached images may not be immediately obvious (I've never used it myself). However the block can display different size images from the main node layout. If #81102: Attach Multiple Images with image_attach using Drupal upload mechanism is committed, allowing multiple attached images, the Attached Image block could be a "short cut" to allow users to call up full-size versions of the image (particularly with Lightbox2 automatic handling installed) while the node display is showing Preview size. Or something like that.
By the way it looks like #81102: Attach Multiple Images with image_attach using Drupal upload mechanism also has an update function
image_attach_update_6101(). Testing the above patch with #81102 already applied, I had to change the function name. I guess whichever issue is committed first gets ownership!Comment #5
joachim commentedWell I'd say this patch is ready to go, so should get the 6101, but image attach is a monster we really want to get sorted once and for all.
I'd rather re-roll this one than that one, so let's postpone this until #81102: Attach Multiple Images with image_attach using Drupal upload mechanism lands.
Comment #6
joachim commentedOn second thoughts, let's get patches IN!
Committed:
#426724 by joachim: Fixed image attach block not showing in block admin.
Comment #7
rsvelko commentedas said in another issue here: the right patch would be either:
DELETE FROM {blocks} blocks WHERE blocks.module = 'image_attach' AND blocks.delta = 0
or
DELETE FROM {blocks} WHERE module = 'image_attach' AND delta = 0
Comment #8
joachim commentedFixed it at #561686: alpha5 -> alpha6 database update 6101 error.