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.
[Upload different image] button under a slide's current image.
I have slides with lots of info in the fields. I want to change the image without deleting it, making a new one, and re-entering all the info.
Comment | File | Size | Author |
---|---|---|---|
#7 | nivo_fix.tar_.gz | 1.31 KB | ami7878 |
#3 | nivo_slider-change_image_field-1620616-3.patch | 3.51 KB | tmsimont |
Comments
Comment #1
Devin Carlson CreditAttribution: Devin Carlson commentedI'd like to keep the slider administration interface simple and straightforward.
You can upload another image and simply copy + paste over any preexisting settings.
Comment #2
tmsimont CreditAttribution: tmsimont commentedpersonally I think that requiring the admin to remove and copy/paste all of that info into a new slide is as far from "simple and straightforward" that you can get. It makes a common task about 5 times harder than it should be. I think I might try to alter this and put up a patch
Comment #3
tmsimont CreditAttribution: tmsimont commentedPatch attached for dev version. This could use some further testing.
Comment #4
tmsimont CreditAttribution: tmsimont commentedUpdating title to be more SEO friendly in case others like me were searching for "update" and "replace" instead of "change"
Also -- below is a brief description of what that patch I attached above does exactly:
add
file_usage_add()
to the install update process and image save process so the image uploaded to the slideshow properly utilizes the file_usage table. This will help the file system understand why this file exists, and more importantly, allow it to be used in a "managed_file" form field field element.adds a "managed_file" "new image" field to the nivo slider settings form that will allow the user to replace the image. when the FID of the "new image" is not the same as what is set as the FID of the slide, the old image is deleted and the new one replaces it.
@see file_usage_add()
@see Form API: managed_file
Comment #5
Devin Carlson CreditAttribution: Devin Carlson commentedComment #6
tmsimont CreditAttribution: tmsimont commentedwhy 8.x?
Comment #7
ami7878 CreditAttribution: ami7878 commentedThis patch worked perfectly for me and is a real lifesaver. I had only one problem though.
All is good if you install nivo_slider with the patch but if you install the patch on a site already using nivo_slider with some slides already set, the slides configuration form fails validation (due to the missing entries in the file_usage table.
Obviously, if you know your way in the database you can manually fix this but for those who don't and/or for those (like me) who have this module installed on many sites, I created the attached module (nivo_fix) that will fix the issue. Onced fixed, the module can be disabled and removed.
IMPORTANT: This module should only be used with the above patch!