Needs review
Project:
Image
Version:
6.x-1.x-dev
Component:
image_import
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Jul 2007 at 21:14 UTC
Updated:
30 Dec 2009 at 12:22 UTC
Jump to comment: Most recent file
Comments
Comment #1
drewish commentedwhen did you download the module? does the same error occur with the 1.4 release?
Comment #2
pelicani commentedI tried both version today and they produced the same results.
5.x-1.x-dev
5.x-1.4
Comment #3
drewish commentedi'm not really sure why that's happening. the import works fine for me... unless i can get some more detail or other people running into the same problem it's hard to figure out what's going on. if you want to install the devel module on your site and then create a logon for me i can get on your site and try look into it.
Comment #4
pelicani commentedThanks for offering to debug, but I don't want to take up your time on this.
So I'll try to debug and ask you questions as I go.
My problems seems to stem from a problem with the original_path...
echo "-".$node->images[IMAGE_ORIGINAL]."
"; //returns as the location of the file I uploaded
$original_path = file_create_path($node->images[IMAGE_ORIGINAL]);
echo "-".$original_path."
"; returns blank
It seems that file_create_path cannot find the file.
I will continue to work on figuring this out, just wanted to post an update to one of my findings.
Thanks in advance.
Comment #5
pelicani commentedI couldn't figure out what changed, but the version I have been using, 5.x.1.0 works fine.
To make sure my server isn't the problem I got a copy of 1.0 and tested it and it works fine as well.
The difference between 1.4 and 1.0 must be documented somewhere, but I haven't seen it.
Would ya'll point me to where I could find out how to configure the latest.
I'd appreciate the assistance.
Thanks in advance.
Comment #6
drewish commentedwhat do you mean by "returns as the location of the file I uploaded"? could you give me an example of one of the paths?
what's your drupal file path set to? what's your image file path set to?
Comment #7
pelicani commented"returns as the location of the file I uploaded"?
I FTP files to the '/images/photos' directory.
This is the directory I've set as the image_import directory.
/home/clients/html/images/photos
The images should be placed in the 'files/images' directory.
But only the Original image is placed there.
And the file I uploaded is deleted.
But the derivitives are not created.
Also note, 1.0 doesn't really work either.
But that is the last version I've used on other sites.
Comment #8
drewish commentedEarlier you said:
Does this mean that when you use image_attach the derivatives are created? Or if you create a new node via node/add/image, that a the derivative images are created?
Comment #9
pelicani commentedThat is correct.
I am able to create an image node as well as attach a new image to an existing node.
Without problems.
All derivatives are created.
Weird.
In my Drupal install, there is a directory named 'files'.
In the files directory is a directory named 'images' that stores the derivatives.
When I use image import, I FTP my images into another directory named 'images' that is not in the 'files' directory but in the root Drupal directory.
This is the directory that is passed to the derivatives code and it fails when is see that path.
I hope this info helps.
I've reverted to an older code base, but that isn't working right either.
I thought it was, but it isn't.
Bumber.
Comment #10
drewish commentedi wonder if it's a permissions issue. can you compare the owner of the originals of a node created by uploading and by importing?
Comment #11
pelicani commentedWhen I debugged the import code, the file_create_path function failed to return any path.
Which means that the derivatives will not run.
At least, that is how I read the code.
The problem with the path seems to be the thing that stops the derivatives.
It seems to expect the path for the new image in the 'files' directory.
But it is getting the old path of the ftp'd image.
echo $node->images[IMAGE_ORIGINAL]; //returns as the location of the file I uploaded
$original_path = file_create_path($node->images[IMAGE_ORIGINAL]);
echo "-".$original_path; //returns blank
Comment #12
drewish commentedThanks for your help tracking that down. I've been able to confirm the bug when importing files that are not within the files directory.
Comment #13
drewish commentedokay, here's a patch that should fix this.
Comment #14
pelicani commentedtweak to the patch, $size = _image_get_sizes(IMAGE_ORIGINAL, $aspect_ratio);
add the underbar to the function name for image get sizes.
also, the original ftp'd file is not being deleted.
weird, because before the patch, that was actually working.
i appreciate your work by the way.
thanks again.
Comment #15
drewish commentedif you update to the latest version of -dev you'll find that there's now a image_get_sizes(). this should get the deletion working again.
Comment #16
drewish commentedafter some more testing i've committed the patch in #15
Comment #17
pelicani commentedYes, I see in the dev version there is that function.
I applied the patch and the derivatives are created correctly.
But the original is not removed.
NOTE: I also loaded your patch for rebuilding derivatives, which works wonderfully.
Comment #18
drewish commentedthe deleting of originals works fine for me, when the new -dev release is posted please test that out. also if a patch is working for you, leave a message on the issue where you found it. that sort of feedback is very valuable.
Comment #19
(not verified) commentedComment #20
rcork commentedBug exists in 6.x codebase
The following code at the bottom of the function image_create_node_from() in image.module fixed this problem for me
$node->new_file = TRUE;
$node->images[IMAGE_ORIGINAL] = $filepath;
// Build derivatives
$node->images = _image_build_derivatives($node, FALSE);
// Save the node.
$node = node_submit($node);
node_save($node);
Comment #21
Hetta commentednew issue here: http://drupal.org/node/242341
Comment #22
joachim commentedWell #242341: Derivatives are not created when using Image Import is marked as a duplicate of this now...
We're actually testing for this (and failing...); see #670686: tests for programmatic image node creation fail because derivatives aren't created.
So: do we change the behaviour here (patch attached for that), or remove those tests?
It's a choice between having slow loading image nodes the first time they are seen, and a longer import process.
From the other issue:
Comment #23
joachim commentedVersion change... patch is on HEAD ;)