Closed (fixed)
Project:
Image
Version:
5.x-1.0
Component:
image.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Mar 2007 at 21:25 UTC
Updated:
2 Mar 2012 at 09:53 UTC
Jump to comment: Most recent file
Comments
Comment #1
drewish commentedi can confirm that is a bug
Comment #2
drewish commentedplease test out the attached patch. i don't think it's quite ready yet but it's close
Comment #3
theiviaxx commentedNo dice. It is still just making an Image_0.jpg. I have been looking at it and i can't figure out where it's is creating those files. It seems, you need to make the incremental original, i.e. Image_0.jpg, first, then pass that into the sizes functions.
Comment #4
drewish commentedwere you uploading a new file? try deleting the existing image nodes and their files, then put in two new files of the same name. you should get image.jpg and image_0.jpg (as well as all the image.*.jpg and image_0.*.jpg files). if you're not getting the resized images you've probably run into http://drupal.org/node/130473
Comment #5
theiviaxx commentedI've tried from scratch with the same outcome. I will check out the other issue. I am also using that patch someone wrote for saving in user folders which may be the cause of it.
It's wierd, right now if i add image 1, then add image 2, only image_0.jpg gets made. But the node is using image.preview.jpg for it's preview image. I thought it odd that it would associate a different preview/thumbnail file with image_0.jpg. I if use print_r($node) to see what in there, if get:
Comment #6
theiviaxx commentedAlso, i fi edit the node using Image_0.jpg and change nothing, then save ('update'), it removed Image.preview.jpg and image.thumbnail.jpg and copies in Image_0.preview and Image_0.thumbnail.jpg. Then if i view the node using Image.jpg, it will then create Image.prewvie.jpg, etc. So in essence to get everything to work right, I have to:
1. Add a node with Image.jpg -- Node1
2. Add a new node with Image.jpg again -- Node2
3. Edit Node2 and save
4. View Node1
I hope this helps you drewish. I will keep looking at it as well.
Thanks
Comment #7
drewish commentedhumm, please give it a try without the other patch. once this is working i'd like to start trying to get dman's patch on #103793 working and committed. it makes the image paths configurable.
Comment #8
theiviaxx commentedI started from a new copy of image.module, then applied the patch. It still does the same thing.
Here is what happens:
Image1 and Image2 are different images and share the same name (image.jpg);
1. Create image node and use image.jpg(Image1)
2. Create image node and use image.jpg(Image2)
3. Image2 will be created as image_0.jpg
4. In the images folder, there is now image_0.preview.jpg and image_0.jpg (Correctly rendered);
5. In the Temp folder, there are Image2's preview and thumbnail sizes, but they are named as image.xxx.jpg not image_0.xxx.jpg
6. Image node 2 using Image2 uses image.preview.jpg <-- Is the Image1 preview image
So i guess this narrows down the DB entries? As the Image1 images are incorrectly being associated with the Image2 node?
I hope the above is clear. Theres a lot going on with this module.
Comment #9
drewish commentedbeen doing some more testing... try this for me. open up each node, edit it, don't make any changes but just save it. go back in and look at the edited node, all the files are right now aren't they?
yeah it's still broken when you upload a file bug as soon as it's re-saved, it seems to straighten itself out...
Comment #10
drewish commentedokay, i think i've gotten it figured out. please try out this patch.
Comment #11
theiviaxx commentedConfirmed working. I just did a simple test (adding one image, then another with the same name) and it created all originals and sizes properly. Thanks drewish!
Comment #12
drewish commentedcool, i want to give walkah a chance to look at it before i commit this
Comment #13
drewish commentedi went ahead and committed this.
Comment #14
oadaeh commentedAfter spending a couple of hours on this problem this morning (I didn't find this issue during my searches :^(), it seems to me the patch is way overkill, and a simple change to one line of code will fix the problem (it did for me).
In the image.module file of the official 5.x download (http://ftp.osuosl.org/pub/drupal/files/projects/image-5.x-1.0.tar.gz), change line 297 from
to
What happens is that at the time of submitting the image node, the temporary copies of the preview and thumbnail images are first deleted from the temp directory and then recreated in the permanent directory. Later on, a file_move operation is called (which calls file_copy) with the source and destination paths of the derivative files being the same. Because those paths are the same, file_copy does nothing.
The derivative files need to be recreated (if that delete and recreation part is even necessary) in the temp directory so that the file_copy operation will complete normally, including the renaming of the files.
Comment #15
drewish commentedthere is some other code clean up in there (the module could still use quite a bit more) but the real meat of the patch is that _image_insert() needs to take the $node by reference so that if the original file gets renamed all the derivative images are renamed accordingly.
by all means if you think there's too many files being created and deleted (and i'm sure there are) grab the new release, cut down on those, and roll a patch. i'd love the help.
Comment #16
(not verified) commentedComment #17
loopy1492 commentedThis is happening in Drupal 7. I delete an image, then upload a new one with the same name, and the old one shows up in its place in my views and pages, even after clearing caches several times.
Comment #18
joachim commentedPlease report that in Drupal core -- it's nothing to do with this project.