I thought that I'd try out File Styles on some images, but I just get this returned for each file in my content:
Notice: Array to string conversion in file_uri_scheme() (line 170 of /var/www/drupal-7/includes/file.inc).
Warning: Cannot convert to ordinal value in file_uri_scheme() (line 170 of /var/www/drupal-7/includes/file.inc).

Plus this once at the bottom:
Notice: Undefined property: stdClass::$filename in theme_file_styles_styles_default() (line 38 of /var/www/drupal-7/sites/all/modules/styles/contrib/file_styles/file_styles.theme.inc).

There is no problem if I leave my display format as 'Generic file'.

Comments

elliotttf’s picture

subscribing... I'm seeing the same thing.

Scott J’s picture

I think that I answered my own question: "There is no problem if I leave my display format as 'Generic file'."

Filefield styles are meant to be applied to 'files', not 'images'. In a sense, image files are already styled.

criz’s picture

confirmed.

Jackinloadup’s picture

Im having a similar if not the same issue. Here is the error I get when formatting an image in views.

Undefined property: stdClass::$uri in file_styles_styles_formatter_filter() (line 102 of /sites/all/modules/styles/contrib/file_styles/file_styles.module).

I get this error when using 7.x-1.0-alpha4 and 7.x-1.x.dev

effulgentsia’s picture

Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new1.42 KB

I marked #921768: Notice: Undefined property: stdClass::$uri in file_styles_styles_formatter_filter() a duplicate, but it contains additional information.

The problem is the object passed to theme('styles_field_formatter'). Currently it's the entity containing the field, but that makes no sense. It needs to be the field item. Here's a fix for that. Note, for the use-case of Media module, it makes no difference, since the media entity containing the file field and the file referenced by that field are one and the same. But for any other use-case, there are bugs like the ones reported here.

effulgentsia’s picture

Title: File Style warnings » File Styles applied to file fields in any entity other than media leads to warnings and lack of display

.

JacobSingh’s picture

Seems okay to me, but I didn't really get a chance to look at it in context. Are there any other consumers of this API who will be surprised when the signature changes?

effulgentsia’s picture

Assigned: Unassigned » effulgentsia
Status: Needs review » Needs work
Issue tags: +Needs tests

Turns out media_youtube.module isn't happy with #5, because it has a theme function relying on information that's in the entity but not the field data. Will post another patch soon, along with tests.

effulgentsia’s picture

Assigned: effulgentsia » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.99 KB

Ideally, still needs tests, but I have other priorities I need to get to first. Posting this here in case it's useful to people, and in case one of the project maintainers wants to commit this without waiting for tests to be added. It's possible there are some modules using Styles for whom this change will break things, though I suspect that's less likely than the #5 patch.

aaron’s picture

Status: Needs review » Needs work

i haven't been alerted to any modules other than the media suite that are currently using the d7 branch of styles. there are some others using d6, but this obviously won't affect that, and considering that fields/entities work differently in d6, there should be nothing to backport anyway. i'm committing this, and setting to needs work for the tests.

thanks, @effulgentsia!

aaron’s picture

Priority: Critical » Normal
aaron’s picture

Title: File Styles applied to file fields in any entity other than media leads to warnings and lack of display » Needs Tests: File Styles applied to file fields in any entity other than media leads to warnings and lack of display

changing title...

aaron’s picture

@effulgentsia: do you happen to remember what blocked the patch in #5 from working for media: youtube? i've refactored styles to work better with media, and ran into issues that would be readily resolved with that patch rather than some hair-raising hacking i've got in place right now.

aaron’s picture

nm, found it in the code documentation. thanks!

geek-merlin’s picture

bluegeek9’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Thank you for your contributions to this issue. As Drupal 7 has reached its End of Life and is no longer supported, we are closing this issue. We encourage you to upgrade to a supported version of Drupal.