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.
As of drupal 7.20 has been released insert module doesn't properly insert images.
Update notes:
The security fixes in this release change all image derivative URLs generated by Drupal to append a token as a query string. (As an example, links that previously pointed to a URL like http://example.com/sites/default/files/styles/thumbnail/public/field/ima... will now point to a URL like http://example.com/sites/default/files/styles/thumbnail/public/field/ima....)
Comment | File | Size | Author |
---|---|---|---|
#22 | setup_filter.png | 116.61 KB | pp |
#21 | 1923336-13.patch | 957 bytes | pp |
#8 | 1923336.patch | 854 bytes | pp |
Comments
Comment #1
MStrzelecki_ CreditAttribution: MStrzelecki_ commentedI have old links from my production env, works as designed and closed. Sorry.
Comment #2
Ben Young CreditAttribution: Ben Young commentedI disagree with this being closed. Insert fails to generate an image using an image style for me since Drupal 7.20.
Comment #3
MStrzelecki_ CreditAttribution: MStrzelecki_ commentedI have update my links on stag env, but some links are broken yet. It seems that image styles inserted with insert module hasn't been created. Does anyone have similar poblem?
Comment #4
MStrzelecki_ CreditAttribution: MStrzelecki_ commentedComment #5
MStrzelecki_ CreditAttribution: MStrzelecki_ commentedThanks for quick replay. I was thinking it is only my problem.
Comment #6
OlafskiOn my site, some of the image styles work with "Insert", others don't. Didn't figure out yet, why.
Comment #7
MStrzelecki_ CreditAttribution: MStrzelecki_ commentedOlafski, for some images you have image's styles generated by other modules perhaps, as I have.
Comment #8
pp CreditAttribution: pp commentedThis patch resolve this issue.
Please review.
Comment #9
MStrzelecki_ CreditAttribution: MStrzelecki_ commentedYes, it works, but overall I have to use absolute paths to see images after save a node. With relative paths I can only see images in wyswigy editor, but not after saving a node. Any ideas why?
Comment #10
MStrzelecki_ CreditAttribution: MStrzelecki_ commentedI turned off pathologic module and now relative paths work also. But what I should do with existing links? It is really a lot of work to manually reinsert all images...
Comment #11
pp CreditAttribution: pp commentedmicz_ thanks for your review!
#10
"I turned off pathologic module and now relative paths work also."
This is a different issue
"But what I should do with existing links? It is really a lot of work to manually reinsert all images..."
This is a good question, but not this issue. :)
If you agree whit this, please set this issue to rtbc
Comment #12
pp CreditAttribution: pp commented"But what I should do with existing links? It is really a lot of work to manually reinsert all images..."
Make a little filter module which replace old links to new with image_style_url.
Comment #13
MStrzelecki_ CreditAttribution: MStrzelecki_ commentedpp, thanks for help! :) should I create issue on pathologic issue queue?
Comment #14
MStrzelecki_ CreditAttribution: MStrzelecki_ commented#12 I have no idea how to do that...
Comment #15
pp CreditAttribution: pp commentedmicz_ make an issue in Drupal Core issue queue.
Comment #16
pp CreditAttribution: pp commentedComment #17
Olafski@micz_ #7, I guess on my site it's "Responsive images and styles", so I created an issue there: #1923936: Responsive images and styles module doesn't work with Drupal 7.20
Comment #18
David_Rothstein CreditAttribution: David_Rothstein commentedChanging the title a bit, since I'm going to link to this from the Drupal 7.20 release announcement and release notes (in the "known issues" section)...
The patch seemed to work for me also. If it's necessary to make it work with older versions of Drupal core too, the new code could be wrapped in a
function_exists('image_style_path_token')
check. (Right now, I think it will lead to a fatal error with older versions.)Comment #19
przemekz CreditAttribution: przemekz commented@ micz_
http://drupal.org/project/ispreg is a temporary solution for broken links. Remember to install VBO.
@ pp #8
Patch doesn't work with File (Field) Paths.
Comment #20
pp CreditAttribution: pp commentedprzemekz(or anybody): could you help me to clarify "doesn't work" ?
1. Patch made for insert module not File (Field) Paths. Did you try to apply this patch for File (Field) Paths git repository?
2. Could you write a short usecase to me? I never use File (Field) Paths and Insert module together. If I can't reproduce your problem, then I can't resolve it.
Comment #21
pp CreditAttribution: pp commentedDavid_Rothstein: #18 is a good point.
Please review.
Comment #22
pp CreditAttribution: pp commentedmicz_ #12
Here is the module: https://drupal.org/project/1924318/git-instructions
Please try it.
Usage:
Enable module
go to the Text formats admin page (admin/config/content/formats) and enable filter to all formats (see picture.)
Comment #23
MStrzelecki_ CreditAttribution: MStrzelecki_ commentedpp #22
It does the job! Great :) How it works? I Can see itoken attached to the end of img links only in view mode in my content body field but not in edit view-source wyswigy mode.
I have uninstall this module, flush cache and image cache, install corrector again and I have itoken added twice. I have a local copy of db, but somebody else could not have it.
Sorry for my english.
Comment #24
pp CreditAttribution: pp commentedmicz_ https://drupal.org/node/1924618 This is a different issue, a different module.
Comment #25
przemekz CreditAttribution: przemekz commented@ #20
I obviously patched Insert module.
I have File (Field) Paths installed and created path for images (field) "images/[current-date:custom:Y]_[current-date:custom:W]/field_images". My public directory is "files" not "sites/default/files".
When I upload and insert some image with style then the image's path is for example /files/styles/my-style/public/myfile.png?itok=0eCQczX- and is OK.
But when I save the node then the uploaded image's path is /files/images/2013_08/field_images/myfile.png. The uploaded image is moved to the custom directory and the path in body field is updated. The new path for the style is /files/styles/my-style/public/images/2013_08/field_images/myfile.png?itok=0eCQczX- and the image doesn't exist.
I suppose that the image_style_path function (image.inc) is never called using as argument /files/images/2013_08/field_images/myfile.png and so the file /files/styles/my-style/public/images/2013_08/field_images/myfile.png?itok=0eCQczX- will never be created.
Sorry for first detailed description it was 2:17 am.
Comment #26
bluehead CreditAttribution: bluehead commentedPatch #21 works
Thanks
Comment #27
Qandeel CreditAttribution: Qandeel commentedPatch # 21 works, I have tested on all of my client's site, thanks
Comment #28
pp CreditAttribution: pp commentedprzemekz #25
Thank's for clarifying. I can reproduce the bug.
This is an File (Field) Paths module bug, because it modifies the image path, but not regenerates image token:
http://drupal.org/node/1925298
bluehead, Qandeel(or anybody who test this patch :) )
Thank's for your review.
Can you change issue status to rtbc?
Comment #29
MStrzelecki_ CreditAttribution: MStrzelecki_ commentedPatch #21 works!
Comment #30
Qandeel CreditAttribution: Qandeel commentedI think this patch should be considered major and I am hoping a quick fix release from maintainer of this module. Can we have some words from the maintainer.???
Comment #31
alippai CreditAttribution: alippai commentedI've reviewed the patch and it seems OK. Comments #18, #26, #27, #29 state that it's tested as well.
Comment #32
quicksketchThanks guys, appreciate the effort. Committed to 7.x-1.x branch and I'll make a new release shortly.