Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
image.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Jan 2011 at 01:18 UTC
Updated:
29 Jul 2014 at 19:18 UTC
Jump to comment: Most recent file
Comments
Comment #1
BOGUƎ commentedSame reasonably clean install, same result.
Comment #2
Ildar Samit commentedSame here.
Comment #3
catchThis is pretty ugly, bumping to major.
Comment #4
aterchin commentedsetting permissions to 777 on the filesystem's 'styles' directory where the -large -medium and -small folders should be created fixed the issue for me. Changed perms back to 755 afterward and all was still fine.
just for testing, afterwards made a new directory in /sites pointed my filesystem there and everything was ok. but no idea why the original /sites/mysite.com/files/styles directory didn't work.
Comment #5
Ildar Samit commented@rpmute magic! :)
Thanks man.
Comment #6
mr.baileysConfirmed this bug by revoking write access on the styles directory before the style-specific subdirectory has been created (or after manually removing that directory). theme_image_style_preview ignores image_style_create_derivative's return code and does not pick up on the fact that it failed to create the subdirectory.
This is basically a configuration error (incorrect permissions set on the files (sub-)folders), hence downgrading to normal. Attached is a patch that only themes the preview if the derivative image exists or could be created. While the patch removes the notices, it does not give visual feedback about why the preview is missing (not sure if we should add an error message for this or not). image_style_create_derivative does log its message in watchdog:
Comment #7
Ildar Samit commentedThe real problem with this bug is that you have no idea what to do when you encounter it. Googling an error message was the only way for me, so I'd say don't hide the message (although a more meaningful one would clearly be better).
Comment #8
pillarsdotnet commentedAdded a meaningful message and made the patch shorter in the process.
Comment #9
pillarsdotnet commentedBetter title.
Comment #10
mr.baileys@pillarsdotnet: thanks for picking this one up!
Regarding your patch:
Comment #11
pillarsdotnet commentedRegarding "strange indentation" versus coding standards:
Personally, I prefer the following rules:
Here is an illustration:
But Drupal style forbids rule #2, so the rest become impractical.
Attached patch slavishly adheres to Drupal Coding Standards but contains a line with 147 characters. I've seen worse, but rarely produced it.
Also at your request, the patch adds the first
watchdog()rather than the ninthdrupal_set_message()in the file.If the goal is to fail with no useful feedback whatsoever, this issue should be closed (won't fix).
Comment #12
mr.baileysPlease re-read my comment: I pointed out that there already is a watchdog error logged when this situation occurs (#1020870-6: theme_image_style_preview() and image_requirements() should check whether style directories are writable), not that we should add another one...
No, this issue started out as a bug about raw warnings being displayed in the interface. At a minimum that needs to be fixed. I'm ok with additional information made available, I'm just not convinced that a drupal_set_message in a theme function is the right place for it.
Comment #13
pillarsdotnet commentedIf both watchdog() and drupal_set_message() are unacceptable, please provide an alternative way to make additional information available.
Comment #14
mr.baileysSee my suggestion in #10: other parts of core that check for writable/non-writable/folder permissions do so via hook_requirements.
For example, if you remove write permissions on sites/default/files, you'll get the following entry in the status report:
Image.module already implements hook_requirements, so we could add an additional check to verify that all folders for all image styles are writable.
Comment #15
pillarsdotnet commentedOkay, created a requirement that image style directories under the file_default_scheme() be writable.
Please review...
Comment #16
pillarsdotnet commentedRevised title.
Comment #17
pillarsdotnet commentedI suppose the
drupal_dirname()call isn't really necessary...Comment #18
pillarsdotnet commentedMore bikeshedding...
Comment #19
pillarsdotnet commentedSlightly shorter / clearer.
Comment #20
pillarsdotnet commentedBah. wrong file.
Comment #21
pillarsdotnet commentedBumping and tagging...
Comment #22
pillarsdotnet commentedYou can help this issue by posting a review:
Decide whether all code and comments comply with Drupal coding standards.
Decide whether any included tests are necessary and sufficient.
Decide whether the patch actually solves the problem. There should be a reproducible test where the current code fails and the patched code succeeds.
A review that affirms success in all of the above should also:
Change the issue status from "Needs Review" to "Reviewed and Tested By the Community".
Otherwise, the review should:
Explain what is wrong with the proposed patch and/or supply a corrections to it.
Change the issue status from "Needs Review" to "Needs Work".
Comment #23
cossovich commentedWill this patch work on Drupal 7?
Comment #24
pillarsdotnet commented@23 yes. Right now there is no significant difference between 8.x and 7.x.
Comment #25
pillarsdotnet commented#20: 1020870-20.patch queued for re-testing.
Comment #26
pillarsdotnet commented#20: 1020870-20.patch queued for re-testing.
Comment #27
pillarsdotnet commented#20: 1020870-20.patch queued for re-testing.
Comment #28
Letharion commentedThere's an issue over here which is older but doesn't have as much progress on seemingly the same thing #873838: theme_image_style_preview() and image_requirements() should check whether style directories are writable.
Comment #29
pillarsdotnet commentedMarking this as a duplicate and combining both patches in the older issue. Thanks Letharion!
Comment #30
Demonthorn commented#20: 1020870-20.patch queued for re-testing.
Comment #32
jrabeemer commentedConfirmed bug. This seems to be related to the other bug mentioned above. Directory permissions related.
Comment #33
pillarsdotnet commentedOnce again, closing as a duplicate of #873838: theme_image_style_preview() and image_requirements() should check whether style directories are writable.
Comment #34
lars toomre commentedVery confusing when two different issues have such long and similar titles...
Comment #35
pillarsdotnet commentedSorry, Lars; that's probably my fault, too.
Comment #36
Tony Finlay commented#20: 1020870-20.patch queued for re-testing.
Comment #38
zpolgar commentedAny new suggestion?
i found this bug in the past days. i had to change a hosting server. In the new server not allowed the php chmod command, for this reason my site not create the image files. I dont'understand why need drupal to change permission, when it comes from the parent.
I tried a clean drupal install, but images styles not work.
My site is on development phase, and no way to finalise it because my provider not allow chmod command in the future.
Comment #39
DeepRed_99 commented#19 worked for me.
It did change some folder permissions, but when i changed them back (+w) it seems to work fine.
Comment #40
Letharion commented