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....)

CommentFileSizeAuthor
#22 setup_filter.png116.61 KBpp
#21 1923336-13.patch957 bytespp
#8 1923336.patch854 bytespp
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MStrzelecki_’s picture

Status: Active » Closed (works as designed)

I have old links from my production env, works as designed and closed. Sorry.

Ben Young’s picture

Status: Closed (works as designed) » Active

I disagree with this being closed. Insert fails to generate an image using an image style for me since Drupal 7.20.

MStrzelecki_’s picture

Status: Active » Needs review

I 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?

MStrzelecki_’s picture

Status: Needs review » Active
MStrzelecki_’s picture

Thanks for quick replay. I was thinking it is only my problem.

Olafski’s picture

On my site, some of the image styles work with "Insert", others don't. Didn't figure out yet, why.

MStrzelecki_’s picture

Olafski, for some images you have image's styles generated by other modules perhaps, as I have.

pp’s picture

Status: Active » Needs review
FileSize
854 bytes

This patch resolve this issue.

Please review.

MStrzelecki_’s picture

Yes, 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?

MStrzelecki_’s picture

I 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...

pp’s picture

micz_ 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

pp’s picture

"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.

MStrzelecki_’s picture

Status: Needs review » Reviewed & tested by the community

pp, thanks for help! :) should I create issue on pathologic issue queue?

MStrzelecki_’s picture

#12 I have no idea how to do that...

pp’s picture

Status: Reviewed & tested by the community » Needs review

micz_ make an issue in Drupal Core issue queue.

pp’s picture

Status: Needs review » Reviewed & tested by the community
Olafski’s picture

@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

David_Rothstein’s picture

Title: doesn't work with drupal 7.20 » Insert module doesn't work with Drupal 7.20

Changing 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.)

przemekz’s picture

@ 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.

pp’s picture

przemekz(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.

pp’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
957 bytes

David_Rothstein: #18 is a good point.

Please review.

pp’s picture

FileSize
116.61 KB

micz_ #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.)

MStrzelecki_’s picture

pp #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.

pp’s picture

micz_ https://drupal.org/node/1924618 This is a different issue, a different module.

przemekz’s picture

@ #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.

bluehead’s picture

Patch #21 works
Thanks

Qandeel’s picture

Patch # 21 works, I have tested on all of my client's site, thanks

pp’s picture

przemekz #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?

MStrzelecki_’s picture

Patch #21 works!

Qandeel’s picture

I 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.???

alippai’s picture

Status: Needs review » Reviewed & tested by the community

I've reviewed the patch and it seems OK. Comments #18, #26, #27, #29 state that it's tested as well.

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

Thanks guys, appreciate the effort. Committed to 7.x-1.x branch and I'll make a new release shortly.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.