Uploaded CCK image thumbnails don't appear after "Next step".

momendo - May 26, 2009 - 20:59
Project:Image FUpload
Version:6.x-3.0-rc2
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

This is a fresh install of the latest 3.0rc2 module thus no need for update.php

I have a custom content type (program-photos) with an Image FUpload field called (field_program_photo).

I have an imagecache preset assigned at "Preview Image Preset" called (program_photos_thumbnail).

I create a new node at http://mysite/node/add/program-photos and upload two images to the content type.

Once submitted and I click, "Next step" which takes me to:
http://mysite/node/add/program-photos/list_imagefields

I get two broken image tags on the page:
http://mysite/sites/default/files/imagecache//japan_0.jpg
http://mysite/sites/default/files/imagecache//kennedycenter.jpg

I can see the files successfully uploaded to the files folder:
/mysite/sites/default/files/kennedycenter.jpg
/mysite/sites/default/files/japan_0.jpg

Under the folder (/mysite/sites/default/files/imagecache/), I can see my imagecache presets like (/mysite/sites/default/files/imagecache/program_photos_thumbnail) but not the images I just uploaded.

What's causing this?

#1

grandcat - May 27, 2009 - 13:06
Category:bug report» support request
Priority:critical» normal

It's neither a critical issue nor a bug.
You should try to set another imagecache preset and try it again.

#2

momendo - May 27, 2009 - 22:07
Category:support request» bug report

I created another imagecache preset. I set Preview Image Preset: * to "scholar_thumbnail"

I create a new node at http://mysite/node/add/program-photos and upload two images to the content type.

Once submitted and I click, "Next step" which takes me to:
http://mysite/node/add/program-photos/list_imagefields

I get two broken image tags on the page:

<fieldset><legend>Image 1</legend><div class="image_fupload_preview"><img src="http://mysite/sites/default/files/imagecache//wakamaru2_0.jpg" alt="wakamaru2_0.jpg" title="wakamaru2_0.jpg"  /></div></fieldset>
<fieldset><legend>Image 2</legend><div class="image_fupload_preview"><img src="http://mysite/sites/default/files/imagecache//wakamaru_0.jpg" alt="wakamaru_0.jpg" title="wakamaru_0.jpg"  /></div></fieldset>

Now, I created a new imagecache preset called "TEST" which has a simple 50% resize action. I set Preview Image Preset: * to "TEST"

I create a new node at http://mysite/node/add/program-photos and upload two images to the content type.

Once submitted and I click, "Next step" which takes me to:
http://mysite/node/add/program-photos/list_imagefields

I get two broken image tags on the page:

<fieldset><legend>Image 1</legend><div class="image_fupload_preview"><img src="http://mysite/sites/default/files/imagecache//asimo2_0.jpg" alt="asimo2_0.jpg" title="asimo2_0.jpg"  /></div></fieldset>
<fieldset><legend>Image 2</legend><div class="image_fupload_preview"><img src="http://mysite/sites/default/files/imagecache//asimo_0.jpg" alt="asimo_0.jpg" title="asimo_0.jpg"  /></div></fieldset>

The images are uploaded to the files folder but there are no derivative images from the uploaded images in the imagecache subfolder.

Shouldn't the path be..

/sites/default/files/imagecache
- TEST (preset name)
    - image.jpg
    - image2.jpg

Example: http://mysite/sites/default/files/imagecache/TEST/asimo_0.jpg

#3

grandcat - May 29, 2009 - 14:10

The path is generated by ImageCache, so it should work. Additionally, it also works for me.
Try to disable Token and other similar modules and try again.

#4

momendo - May 29, 2009 - 15:33

I disabled Token and Pathauto. I still get the same result. The images upload, but the path is wrong and the derivative imagecache images are not generated.

<fieldset>
<legend>Image 4</legend>
<div class="image_fupload_preview">
<img title="asimo_0.jpg" alt="asimo_0.jpg" src="http://mysite/sites/default/files/imagecache//asimo_0.jpg"/>
</div>
</fieldset>

I am using the latest code:
Acquia Drupal 1.2.9
Token 6.x-1.11
Pathauto 6.x-1.1
Image FUpload 6.x-3.0-rc2
ImageAPI 6.x-1.6
ImageCache 6.x-2.0-beta9
ImageField 6.x-3.0
FileField 6.x-3.0
CCK 6.x-2.2

What modules are you using?

#5

grandcat - May 30, 2009 - 09:08

It seems that your selected imagecache preset is not used correctly. I have to check this closer.

#6

viz8 - June 1, 2009 - 06:39

Were you able to solve this problem? Today I had it working for a while, and then it broke (just like you describe - all images suffixed by a _0, they dont display, and they aren't saved into the appropriate folder). I tried all the same settings in another website, and it worked again. Trying to troubleshoot, i copied all the modules from one website to another (assuming the problem came from a module upgrade), and then it broke again. Thus, I am led to believe this is the problem of some upgrade somewhere.... but after 2-3 hrs of searching, i'm giving up for today. Please let me know if you figure it out.

#7

viz8 - June 1, 2009 - 06:59

Ok, 5 mins after my previous post, i figured it out (at least for my case). The problem has to do with the file-path settings and token. If i enter something with a token, my upload breaks, and if i leave it empty, it works fine. I am also getting this message, whether it works or not "warning: Invalid argument supplied for foreach() in ...\sites\all\modules\image_fupload\includes\images.previewlist.imagefield.inc on line 44.". This is probably unrelated, but i wanted to make the observation. I need to save these files with token values, so i believe this is still an important issue. Thanks!

#8

viz8 - June 1, 2009 - 07:33

Nevermind my last post. The problem is not with Token, but with the filepath field in general. Anything i write in it makes the uploads break for me.

#9

awolfey - June 1, 2009 - 20:03

subscribe

#10

viz8 - June 1, 2009 - 21:00

Alright, after working on this for a while, i looked at a related thread (http://drupal.org/node/409070) and then copied this code below from another module into image_fupload_imagefield.module . Right now it works, as it creates the appropriate folder, but it doesn't work well with Token. For example, my filepath is users/[user]/images and after uploading two images, there are two folders created: users/[user]/images and users/viz/images, and all the images fall on the first one. The code creates the appropriate folder, but the images are misplaced (or don't get moved).

//insert under line 302 of image_fupload_imagefield.module
if (!is_dir($files_path)) {
    mkdir($files_path, 0777, TRUE);
}
file_check_directory($files_path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);

#11

wesoccer2003 - June 20, 2009 - 04:02

subscribe

#12

svenhs - June 23, 2009 - 20:53

Had the same issue (broken imagecache-thumbnails after upload --> but original files stored in the right path). For me deactivating the Fupload module and reactivating it again, solved the problem.

#13

valante - July 5, 2009 - 20:51

Okay, been digging into this for half an hour now. Here's what I found:

1) I have a CCK image field configured to work FUpload and an ImageCache preset called AlbumPreview.
2) In the variables table, the relevant variable (image_node_types) was set to:

a:2:{s:5:"image";a:4:{s:4:"type";s:5:"image";s:9:"fieldname";s:6:"images";s:15:"image_selection";N;s:17:"imagecache_preset";s:12:"AlbumPreview";}s:7:"picture";a:4:{s:4:"type";s:3:"cck";s:9:"fieldname";s:11:"field_image";s:15:"image_selection";s:7:"preview";s:17:"imagecache_preset";N;}}

3) Notice the "AlbumPreview" string after the "imagecache_preset" in the first array element (represents the original field), and the "N" after the "imagecache_preset" in the second array element (represents the CCK image field)
4) Changed the last N to s:12:"AlbumPreview" in the table
5) Voila! I get thumbnails.

So now just have to find who writes to image_node_types, and why it misses the preset name...

~ Tal

#14

valante - July 5, 2009 - 21:24

Narrowing down the problem:

The culprit is image_fupload_imagefield_widget.inc .

function image_fupload_imagefield_widget_settings_save($widget) {
  // elements which should be saved for this field (settings)
  $settings = array('fupload_mode', 'fupload_previewlist_img_attributes', 'fupload_title_replacements', 'fupload_previewlist_field_settings', 'fupload_previewlist_redirecturl');
  _fupload_imagepreview_settings('write', $widget['type_name'], array('fieldname' => $widget['field_name'], 'preview_preset' => $widget['fupload_previewlist_img']));

For some reason, the 'preview_preset' => $widget['fupload_previewlist_img'] doesn't get the preset name.

Compare with image_fupload_image.admin , where it says:

  _fupload_imagepreview_settings('write', 'image', array('preview_preset' => $form_state['values']['fupload_previewlist_img']));

I tried wrapping the preview_preset in an array, but no luck.

I've tested this theory by creating a new content type, adding file field with FUpload widget, and then checking the variables table. Yup, it enters N instead of the preset name.

Anyone cares to jump in? I don't actually know a single thing in PHP, I'm just doing some C#-style bug-hunting, and I think I've just reached my limits.

~ Tal

#15

valante - July 5, 2009 - 22:44

Okay, ignore last post - I misinterpreted the array thing. Happens when you don't know the language, like I said. I'm still pretty sure the problem is there, though. The 'preview_preset' => $widget['fupload_previewlist_img'] doesn't get the preset name into 'preview_preset'.

Would very much like to see someone solve this... It's holding me back in a project I'm working on.

Thanks,

~ Tal

(P.S. Sorry for all the posts today)

#16

Primsi - August 17, 2009 - 10:24

subscribe

#17

kirilius - August 31, 2009 - 14:36

Subscribe as well.

I am getting mixed results as well. When I am using custom token-based paths, it tends to break a lot more leaving me with a page listing a bunch of images while no imageas are actually visible.

#18

kirilius - September 1, 2009 - 02:39

Actually even without the token getting in the way, I am not seeing thumbs after I click on the next step. After I save, the images are preserved and thumbs show up, but not the first time. In fact the path to the supposed thumbs contain // (two slashes with nothing in between) suggesting that the imagecache path is not getting generated properly the first time.

#19

Steve Dondley - September 10, 2009 - 02:59

I can confirm comment #13 above (http://drupal.org/node/473602#comment-1778016).

That serialized data with the "N" in there is messing things up. After I replaced the value of the image_node_type variable with data from an old snapshot of the my database, everything worked fine for me, too.

DID NOT WORK:

a:3:{s:5:"image";a:4:{s:5:"title";s:5:"Image";s:9:"fieldname";s:6:"images";s:15:"image_selection";s:7:"preview";s:17:"imagecache_preset";s:0:"";}s:12:"custom_image";a:4:{s:4:"type";s:3:"cck";s:9:"fieldname";s:19:"field_gallery_image";s:15:"image_selection";N;s:17:"imagecache_preset";N;}s:5:"album";a:4:{s:4:"type";s:3:"cck";s:9:"fieldname";s:17:"field_album_image";s:15:"image_selection";N;s:17:"imagecache_preset";N;}}

WORKED:

a:3:{s:5:"image";a:4:{s:5:"title";s:5:"Image";s:9:"fieldname";s:6:"images";s:15:"image_selection";s:7:"preview";s:17:"imagecache_preset";s:0:"";}s:12:"custom_image";a:4:{s:4:"type";s:3:"cck";s:9:"fieldname";s:19:"field_gallery_image";s:15:"image_selection";N;s:17:"imagecache_preset";s:12:"gallery_main";}s:5:"album";a:4:{s:4:"type";s:3:"cck";s:9:"fieldname";s:17:"field_album_image";s:15:"image_selection";N;s:17:"imagecache_preset";s:12:"gallery_main";}}

 
 

Drupal is a registered trademark of Dries Buytaert.