I have installed the image.module and image_import.module, both updated today. The whole process seems to work, up until the very end, where I get the following information (note: I was actually uploading about six images...I shortened the info as it is all repeated):

* DEBUG MODE ENABLED for image_import_import() function. There will be extra messages issued.
* DEBUG: Image file extensions: gif,GIF,jpg,JPG,jpeg,JPEG,png,PNG,tif,TIF,tiff,TIFF
* DEBUG: Caption file extensions: html,HTML,htm,HTM,txt,TXT,caption,CAPTION
* DEBUG: Import called for (path=image_import/admin/helen.jpg)
* DEBUG: Access checks succeeded for image_import/admin/helen.jpg
* Found caption file image_import/admin/helen.txt
* Caption 32 characters, teaser 32 characters, for helen.jpg.
* DEBUG: Image helen.jpg prechecks okay and should import successfully.

and then:

# File copy failed: no directory configured, or it could not be accessed.
# File copy failed for image_import/admin/helen.jpg to

and then:

Successfully imported 0 file(s) out of 5, with 0 captioned from files.

It looks to me like it can't find the folder to which to copy the images, which is: files/images/
the same as is used for image.module. At least I assume it is. I tried to uploaded a single image with image.module just to make sure it works. I DO NOT have upload.module installed.

What am I missing?
Thanks,
Maria

Comments

mariagwyn’s picture

Sorry...I forgot:

All relevant directories have full read/write permissions. I just checked via ftp.

Thanks,
Maria

syscrusher’s picture

Component: User interface » Documentation
Assigned: Unassigned » syscrusher

I have just committed a new version to CVS. This version documents the need for the default image path and the image import path to be different, and also enforces that restriction in the code, to prevent this error from happening.

Test reports appreciated. :-)

Scott

syscrusher’s picture

mariagwyn’s picture

Scott,

Thank you thank you thank you thank you. I have been waiting for a long time for this module to straighten out so I can use it, and it works. But of course, I have some follow-up questions.

The new addition adds this to my admin page:
"This path must be different from the image default path, which on this site is currently set to "files/imagesfiles""

Question: I have no file called "imagesfiles." The true default path is files/images/.... So, what is it saying?
So, I took a look at both my source code for the page, and the files on the server itself. The five images I imported to test all uploaded correctly, with the .txt file for the caption. However, I can't find where the image files themselves are located. In the files/images folder are the following files: imagesfiles, imagesfiles_0, _1, etc. The same set of files is in files/ as well. This matches the source code, which is:
Only local images are allowed.

Questions:
1. are the 'imagesfiles_X' actually the photos imported?
1b. why the double backslash after images in the url?
2. Is there any way to get them to keep the actual name of the original .jpg/.gif? This is important incase I have to delete photos from the server, I want to have the names recognizable.
3. Is there a way for the 'alt' and 'title' tags to take the caption name rather than the photo name?

Other than that, thank you again, I am delighted that it works.

Maria

mariagwyn’s picture

oops...did something wrong in the code, here is the rest:

source code: img src="http://www.stnina.org/test/files/images//imagesfiles_2" width="100" height="114" alt="teva.jpg" title="teva.jpg"

So, Questions:

1. Is there a way for the imagesfiles_1,_2, etc., to still have the name/format 'photo.jpg' so that I can tell when I look into the files/images what the photos are?
2. Is there a reason that the files are importing into files/ rather than my default, files/images?
3. Is there a way to set the titles so that they do not include the filename but the Caption? So, alt="Teva R." rather than "teva.jpg." I can modify then in the setting page, but it would be great if it could take the titles from the caption.

Thanks again, this is very handy!

Maria

syscrusher’s picture

The new addition adds this to my admin page:
"This path must be different from the image default path, which on this site is currently set to "files/imagesfiles""

Question: I have no file called "imagesfiles." The true default path is files/images/.... So, what is it saying?

Can you give me the output of the following MySQL command?
select * from variable where name like 'image%';
That should tell me what's going on internally.

Thanks.

Scott

mariagwyn’s picture

Scott, here it is:

SQL-query:
SELECT *
FROM variable
WHERE name LIKE 'image%'
LIMIT 0 , 30

Full Texts
name

value
Edit Delete image_background s:7:"#000000";
Edit Delete image_block_title s:15:"Image Galleries";
Edit Delete image_convert_path s:22:"/usr/local/bin/convert";
Edit Delete image_default_filename s:8:"original";
Edit Delete image_default_max_size s:8:"1024x768";
Edit Delete image_default_max_weight s:3:"200";
Edit Delete image_default_path s:13:"files/images/";
Edit Delete image_default_resolution s:7:"640x480";
Edit Delete image_default_resolutions s:34:"640x480,800x600,1024x768,1600x1200";
Edit Delete image_default_thumb_path s:20:"files/images/thumbs/";
Edit Delete image_default_thumb_size s:2:"75";
Edit Delete image_gallery_max_kb s:4:"1000";
Edit Delete image_gallery_thumb s:4:"last";
Edit Delete image_gallery_thumb_cols s:1:"3";
Edit Delete image_gallery_thumb_order s:5:"title";
Edit Delete image_gallery_thumb_rows s:1:"5";
Edit Delete image_help s:2:"
";
Edit Delete image_images_per_page s:1:"6";
Edit Delete image_import_debug s:1:"1";
Edit Delete image_import_default_import_path s:15:"image_import/%U";
Edit Delete image_import_default_upload_path s:12:"image_import";
Edit Delete image_import_force_delete s:1:"1";
Edit Delete image_import_system_nou s:1:"0";
Edit Delete image_import_throttle s:1:"0";
Edit Delete image_import_timeout s:1:"0";
Edit Delete image_jhead_path s:0:"";
Edit Delete image_lib s:11:"imagemagick";
Edit Delete image_nav_vocabulary s:1:"5";
Edit Delete image_personal_gallery s:1:"0";
Edit Delete image_personal_gallery_max_num s:2:"50";

Greek to me! Actually, I know Greek. How about Akkadian to me! Don't know that one. Any thoughts on the issue of titles/tags? While I can go through and change the names, it would sure be nice not to have to do that. But I can live with it. I can't be too demanding since I can't write the code myself.

Thanks again for your work and help.
Maria

syscrusher’s picture

Hi, Maria

I looked into this further, and it looks as if you may be running an older version of image.module, upload.module, or both. Just out of curiosity, what are the versions of each? You can look at the $Id$ line near the top of each file. This may be a silly question, but you *are* running Drupal 4.6, right?

Also...can you please run one more SQL query for me? SELECT * FROM VARIABLE WHERE NAME='file_directory_path';
This should return exactly one record.

Thanks.

Scott

syscrusher’s picture

For reference, my versions are:
upload.module 1.31.2.5
image.module 1.146.2.6
image_import.module 1.9

syscrusher’s picture

I just committed to CVS a new version that adds a test for missing file_directory_path setting in the variable table. This won't "fix" this problem, but it will hopefully detect it.

Scott

mariagwyn’s picture

Okay, here is the information:

I am running...
/* $Id: upload.module,v 1.31.2.5 2005/05/25 04:28:59 unconed Exp $ */
// $Id: image.module,v 1.146.2.7 2005/06/11 22:12:17 walkah Exp $
// $Id: image_import.module,v 1.10 2005/06/28 03:21:17 syscrusher Exp $ (just added updated this)

I ran the SQL Query:
SQL-query: Documentation

SELECT *
FROM VARIABLE
WHERE NAME = 'file_directory_path'
LIMIT 0 , 30

MySQL said: Documentation
#1146 - Table 'stninaqt_snqdb1.VARIABLE' doesn't exist

Somehow, that doesn't seem right. So, I checked, and the table does indeed exists, with the following data:

Edit Delete theme_default s:6:"snqphp";
Edit Delete filter_html_1 s:1:"1";
Edit Delete node_promote_contact s:1:"0";
Edit Delete phptemplate_extra_logic a:1:{s:31:"themes/democratica/template.php";s:31:"...
Edit Delete theme_democratica_settings a:9:{s:12:"default_logo";s:1:"0";s:9:"logo_path";s...
Edit Delete image_default_path s:13:"files/images/";
Edit Delete image_default_thumb_path s:20:"files/images/thumbs/";
Edit Delete image_temp_path s:17:"files/images/tmp/";
Edit Delete drupal_server s:36:"http://civicspacelabs.org/xmlrpc.php";
Edit Delete phptemplate_extra_templates a:2:{s:18:"themes/democratica";a:3:{s:34:"themes/d...
Edit Delete theme_editor_engine_real_engines a:0:{}
Edit Delete contact_forms_fid i:1;
Edit Delete civicspace_has_admin i:1;
Edit Delete site_name s:22:"The St. Nina Quarterly";
Edit Delete site_mail s:15:"changed....";
Edit Delete site_slogan s:0:"";
Edit Delete site_mission s:0:"";
Edit Delete site_footer s:85:"All content on this site © 2005 the St. ...
Edit Delete drupal_directory s:1:"0";
Edit Delete wizard_history s:5:"basic";
Edit Delete basic s:1:"1";
Edit Delete wizard_previous s:13:"administrator";
Edit Delete wizard_next s:15:"getting_started";
Edit Delete statistics_enable_access_log s:1:"1";
Edit Delete clean_url s:1:"1";
Edit Delete user_register s:1:"2";
Edit Delete contact_block_source i:2;
Edit Delete mass_mailer_engine s:7:"phplist";
Edit Delete configure_list_debug s:1:"1";
Edit Delete mass_mailer_footer s:101:"--
'To unsubscribe from this list visit [U...

Note: I am happy to delete the table and recreate it if necessary.

I then tried to upload two images with the new module, and this is what I got:

warning: in_array(): Wrong datatype for second argument in /home/stninaqt/public_html/test/modules/image_import/image_import.module on line 662.

warning: in_array(): Wrong datatype for second argument in /home/stninaqt/public_html/test/modules/image_import/image_import.module on line 663.

warning: in_array(): Wrong datatype for second argument in /home/stninaqt/public_html/test/modules/image_import/image_import.module on line 664.

warning: in_array(): Wrong datatype for second argument in /home/stninaqt/public_html/test/modules/image_import/image_import.module on line 665.

warning: in_array(): Wrong datatype for second argument in /home/stninaqt/public_html/test/modules/image_import/image_import.module on line 661.

warning: in_array(): Wrong datatype for second argument in /home/stninaqt/public_html/test/modules/image_import/image_import.module on line 662.

warning: in_array(): Wrong datatype for second argument in /home/stninaqt/public_html/test/modules/image_import/image_import.module on line 663.

warning: in_array(): Wrong datatype for second argument in /home/stninaqt/public_html/test/modules/image_import/image_import.module on line 664.

warning: in_array(): Wrong datatype for second argument in /home/stninaqt/public_html/test/modules/image_import/image_import.module on line 665.

I also received this:

* DEBUG MODE ENABLED for image_import_import() function. There will be extra messages issued.
* DEBUG: Image file extensions: gif,GIF,jpg,JPG,jpeg,JPEG,png,PNG,tif,TIF,tiff,TIFF
* DEBUG: Caption file extensions: html,HTML,htm,HTM,txt,TXT,caption,CAPTION
* DEBUG: Import called for (path=image_import/admin/d3.jpg)
* DEBUG: Access checks succeeded for image_import/admin/d3.jpg
* Found caption file image_import/admin/d3.txt
* Caption 17 characters, teaser 17 characters, for d3.jpg.
* DEBUG: Image d3.jpg prechecks okay and should import successfully.
* DEBUG: System image directory is 'files/imagesfiles'.
* DEBUG: Copied image_import/admin/d3.jpg to files/imagesfiles_5.
* DEBUG: Saved node nid=104
* DEBUG: Saved taxonomy for node nid=104
* DEBUG: Built derivatives for node nid=104
* DEBUG: Import called for (path=image_import/admin/v3.jpg)
* DEBUG: Access checks succeeded for image_import/admin/v3.jpg
* Found caption file image_import/admin/v3.txt
* Caption 24 characters, teaser 24 characters, for v3.jpg.
* DEBUG: Image v3.jpg prechecks okay and should import successfully.
* DEBUG: System image directory is 'files/imagesfiles'.
* DEBUG: Copied image_import/admin/v3.jpg to files/imagesfiles_6.
* DEBUG: Saved node nid=105
* DEBUG: Saved taxonomy for node nid=105
* DEBUG: Built derivatives for node nid=105

* Deleted caption file image_import/admin/d3.txt
* Deleted image file image_import/admin/d3.jpg
* Deleted caption file image_import/admin/v3.txt
* Deleted image file image_import/admin/v3.jpg
* Successfully imported 2 file(s) out of 2, with 2 captioned from files.
* Deleted 2 image(s) and associated caption(s) from the import directory.

The images almost uploaded correctly. The thumbnail is present, as is the node. However, the image is not, and now I get the following error:
warning: in_array(): Wrong datatype for second argument in /home/stninaqt/public_html/test/modules/node.module on line 1300.

That is a lot, hope it helps.
Maria

mariagwyn’s picture

oops, a correction:

The image appears correctly. However, when I go in as admin and edit the image, only the thumbnail appears and I get the node.module error.

Thanks,
Maria

syscrusher’s picture

scripsit Maria:
> SELECT *
> FROM VARIABLE
> WHERE NAME = 'file_directory_path'LIMIT 0 , 30
>
> MySQL said: Documentation
> #1146 - Table 'stninaqt_snqdb1.VARIABLE' doesn't exist

Oops -- my bad! I forgot that table names are case-sensitive in MySQL. Sorry about that. The query should have been
SELECT * from variable WHERE name='file_directory_path';

Scott

syscrusher’s picture

Here is the code that is giving errors for you, Maria:

  $nodeoptions = variable_get('node_options_image_import',array());
// ... snip ...
  $node->promote  = in_array('promote', $nodeoptions) ? 1 : 0;
  $node->status   = in_array('status', $nodeoptions) ? 1 : 0;
  $node->sticky   = in_array('sticky', $nodeoptions) ? 1 : 0;
  $node->revision = in_array('revision', $nodeoptions) ? 1 : 0;
  $node->moderate = in_array('moderate', $nodeoptions) ? 1 : 0;
  $node->comment  = variable_get('comment_image_import',0);

What is supposed to be happening here is that we retrieve the default workflow settings for the "image_import" node type into the variable $nodeoptions, which is supposed to be an array. Then I look at your settings for promote, sticky, status (really "publish"), etc., and respect those settings by copying them into the new "image" node that we are creating.

We read "image_import" as the type rather than "image" because an administrator might want to have different workflow behavior for "images that get mass-imported" versus "images that I hand-import one at a time".

Now, I can (and will) fix the code so that it provides a default empty array if the variable_get() call returns nothing. I'm not sure why that didn't happen already, but...there it is. That being said, you really need to go set the workflow for the "image_import" content type so that you'll have this initialized.

I can also tell from your variable table contents that you haven't saved settings for the "upload" module yet, either. Last night's CVS version of image_import.module tests for the latter condition, and explicitly warns you about the problem. I'll also add something that issues a warning message if no default workflow is set. In that case, I can actually fall back to a reasonable default; if upload.module isn't configured, though, I have no good default option without hard-wiring into my code the default from upload.module itself, something I am loathe to do because if that module changes, then it breaks my module.

No easy answers...I need to think about this.

In any case, please initialize settings for the file upload directory (in "q=admin/settings", under "File System Settings"), and initialize the workflow settings (in "q=admin/node/configure/types/image_import"), and try one more time. I think you'll have better results. :-)

Scott

mariagwyn’s picture

Scott,

1. image_assist is a typo...one of many on my part.

2. I saved my upload settings as you directed. When I import 2 images,
this is what I get:

warning: in_array(): Wrong datatype for second argument in
/home/stninaqt/public_html/test/modules/image_import/image_import.module on
line 661.This error continues through line 665, and repeats twice, I assume
becuase I imported 2 images.

3. Once the image is imported, this is the text
I receive with the DEBUG mode enabled:

* DEBUG MODE ENABLED for image_import_import() function. There will be extra messages issued.
* DEBUG: Image file extensions: gif,GIF,jpg,JPG,jpeg,JPEG,png,PNG,tif,TIF,tiff,TIFF
* DEBUG: Caption file extensions: html,HTML,htm,HTM,txt,TXT,caption,CAPTION
* DEBUG: Import called for (path=image_import/admin/k2.jpg)
* DEBUG: Access checks succeeded for image_import/admin/k2.jpg
* Found caption file image_import/admin/k2.txt
* Caption 17 characters, teaser 17 characters, for k2.jpg.
* DEBUG: Image k2.jpg prechecks okay and should import successfully.
* DEBUG: System image directory is 'files/imagesfiles'.
* DEBUG: Copied image_import/admin/k2.jpg to files/imagesfiles.
* DEBUG: Saved node nid=108
* DEBUG: Saved taxonomy for node nid=108
* DEBUG: Built derivatives for node nid=108
* DEBUG: Import called for (path=image_import/admin/n2.jpg)
* DEBUG: Access checks succeeded for image_import/admin/n2.jpg
* Found caption file image_import/admin/n2.txt
* Caption 26 characters, teaser 26 characters, for n2.jpg.
* DEBUG: Image n2.jpg prechecks okay and should import successfully.
* DEBUG: System image directory is 'files/imagesfiles'.
* DEBUG: Copied image_import/admin/n2.jpg to files/imagesfiles_0.
* DEBUG: Saved node nid=109
* DEBUG: Saved taxonomy for node nid=109
* DEBUG: Built derivatives for node nid=109
* DEBUG: Import called for (path=image_import/admin/v2.jpg)
* DEBUG: Access checks succeeded for image_import/admin/v2.jpg
* Found caption file image_import/admin/v2.txt
* Caption 24 characters, teaser 24 characters, for v2.jpg.
* DEBUG: Image v2.jpg prechecks okay and should import successfully.
* DEBUG: System image directory is 'files/imagesfiles'.
* DEBUG: Copied image_import/admin/v2.jpg to files/imagesfiles_1.
* DEBUG: Saved node nid=110
* DEBUG: Saved taxonomy for node nid=110
* DEBUG: Built derivatives for node nid=110
* DEBUG: Import called for (path=image_import/admin/v4.jpg)
* DEBUG: Access checks succeeded for image_import/admin/v4.jpg
* Found caption file image_import/admin/v4.txt
* Caption 32 characters, teaser 32 characters, for v4.jpg.
* DEBUG: Image v4.jpg prechecks okay and should import successfully.
* DEBUG: System image directory is 'files/imagesfiles'.
* DEBUG: Copied image_import/admin/v4.jpg to files/imagesfiles_2.
* DEBUG: Saved node nid=111
* DEBUG: Saved taxonomy for node nid=111
* DEBUG: Built derivatives for node nid=111

All the images import correctly. Yea! However...

4. Note the Debug lines:
* DEBUG: Image n2.jpg prechecks okay and should import successfully.
* DEBUG: System image directory is 'files/imagesfiles'.
* DEBUG: Copied image_import/admin/n2.jpg to files/imagesfiles_0.

The image was originally n2.jpg. Despite what DEBUG
says, it is saved in files/images/ (not files/), and it is saved not as a
.jpg, but as 'imagesfiles or _1 or _2 or _3. The thumbnails are also
.thumbnails, _1, _2, _3. This is the first thing I was referring to about
titles. If I actually look into the folder into which the images are
imported, I can no longer tell what the picture is b/c the file format has
changed to imagesfiles_1 rather than .jpg or .gif. Further, the name itself
is gone, no more 'n2', or 'blueboat', but 'imagesfiles'. While this isn't
the end of the world, it does make knowing what my images are rather
difficult once they are imported. If I wanted to cheat and overwrite an
image, I would have not idea what image to overwrite.

5. I think you generally get what I mean about the name of the image in the
site itself. Ideally, the .txt file would have both a caption and title
area, perhaps separated by a tab or comma, or TITLE: whatever CAPTION:
whatever? This just saves the time of going into the 18billion images
conveniently uploaded by your module and having to change the name of the
node. However, numbers 1-4 are much more important than this.

6. Finally, I did try to import an image using the regular image content
type. It imported successfully. But, when I go to admin to edit the image,
I receive the following errors:

warning: in_array(): Wrong datatype for second argument in
/home/stninaqt/public_html/test/modules/node.module on line 1300.When
importing an image as content:

warning: in_array(): Wrong datatype for second argument in
/home/stninaqt/public_html/test/modules/node.module on line 1296.warning:
in_array(): Wrong datatype for second argument in
/home/stninaqt/public_html/test/modules/node.module on line 1297.warning:
in_array(): Wrong datatype for second argument in
/home/stninaqt/public_html/test/modules/node.module on line 1298.warning:
in_array(): Wrong datatype for second argument in
/home/stninaqt/public_html/test/modules/node.module on line 1299.warning:
in_array(): Wrong datatype for second argument in
/home/stninaqt/public_html/test/modules/node.module on line 1300.

I am not sure if they are related, but I thought I would let you know.

Thanks again for all your work.

Maria

syscrusher’s picture

Maria wrote:

6. Finally, I did try to import an image using the regular image content
type. It imported successfully. But, when I go to admin to edit the image,
I receive the following errors:

warning: in_array(): Wrong datatype for second argument in
/home/stninaqt/public_html/test/modules/node.module on line 1300.When
importing an image as content:
warning: in_array(): Wrong datatype for second argument in
/home/stninaqt/public_html/test/modules/node.module on line 1296.warning:
in_array(): Wrong datatype for second argument in
/home/stninaqt/public_html/test/modules/node.module on line 1297.warning:
in_array(): Wrong datatype for second argument in
/home/stninaqt/public_html/test/modules/node.module on line 1298.warning:
in_array(): Wrong datatype for second argument in
/home/stninaqt/public_html/test/modules/node.module on line 1299.warning:
in_array(): Wrong datatype for second argument in
/home/stninaqt/public_html/test/modules/node.module on line 1300.

I am not sure if they are related, but I thought I would let you know.

This is related. The errors you're seeing from node.module are due to those default workflow settings I mentioned previously. Something is very odd in your workflow settings.

What is the result of the following MySQL query?
select * from variable where name like 'node_options_image%';
It should look something like this:

+---------------------------+--------------------------------------------------------------------------------------------------+
| name                      | value                                                                                            |
+---------------------------+--------------------------------------------------------------------------------------------------+
| node_options_image        | a:2:{i:0;s:6:"status";i:1;s:7:"promote";}                                                        |
| node_options_image_import | a:5:{i:0;s:6:"status";i:1;s:8:"moderate";i:2;s:7:"promote";i:3;s:6:"sticky";i:4;s:8:"revision";} |
+---------------------------+--------------------------------------------------------------------------------------------------+

Notice how each value is a serialized PHP array? This is what image_import.module expects, and also what node.module expects. For some reason, in your system these values aren't arrays. These values are set when you save the content-type settings in q=admin/node/configure/types/image and q=admin/node/configure/types/image_import.

Scott

ricabrantes’s picture

Status: Active » Closed (fixed)