Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In Styles 1.x, you had this code:
function file_styles_styles_presets() {
...
foreach (image_styles() as $style_name => $style) {
$presets['file'][$style_name]['image'] = array($style_name);
}
...
}
In Styles 2.x, no such code exists in file_styles_styles_default_presets().
So in 1.x, when I added an image style "foo" via admin/config/media/image-styles/add, and then went to admin/config/media/types/manage/image/display, "File Style: foo" would be a format option for the file field. But in 2.x, it isn't.
This also means that if I upgrade a site from 1.x to 2.x that was using "File Style: foo", then it gets reverted to "Generic File" instead.
Was this an intentional change?
Comment | File | Size | Author |
---|---|---|---|
#7 | file-styles-support-media-file-image-1058056-7.patch | 3.91 KB | aaron |
Comments
Comment #1
effulgentsia CreditAttribution: effulgentsia commentedAt DrupalCon, Aaron said this was not an intentional change. I'll work on a patch.
Comment #2
oxyc CreditAttribution: oxyc commentedSeems like he abstracted this into effects. Currently that line of code exists in
file_styles.effects.inc
.file_styles.admin.inc
also has some code (commented out) for displaying effects in vertical tabs. I tried working on it but gave up for now.Although, a proper patch for making image styles available, even if temporarily, would be much appreciated on my side at least. I've made a few attempts at revealing them as presets but they are all ugly hacks.
Comment #3
neurojavi CreditAttribution: neurojavi commentedsubscribing
Comment #4
ybabel CreditAttribution: ybabel commentedsuscribing too
Comment #5
aaron CreditAttribution: aaron commentedfixed; commit at http://drupalcode.org/project/styles.git/commit/803247c
Comment #6
aaron CreditAttribution: aaron commentedand at http://drupalcode.org/project/styles.git/commit/2c15e41 oops...
Comment #7
aaron CreditAttribution: aaron commentedalso committed this patch, which adds media styles as formatters.
Comment #8
aaron CreditAttribution: aaron commentedoops, rather http://drupalcode.org/project/styles.git/commitdiff/fe77559?hp=d3c514acf... and http://drupalcode.org/project/styles.git/commitdiff/3cc6b9f?hp=fe775598d... (forgot to increment the update).
Comment #9
nyl_auster CreditAttribution: nyl_auster commentedIt works :)
I tried the latest version on the Git repository and It seems to me that problems are gone. Like Effulgentsia I could not use image presets defined in admin/config/media/image-styles on files styles.
With this update, now, I can.
Thx