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?

Comments

grandcat’s picture

Category: bug » support
Priority: Critical » Normal

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

jrabeemer’s picture

Category: support » bug

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

grandcat’s picture

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.

jrabeemer’s picture

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?

grandcat’s picture

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

blup’s picture

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.

blup’s picture

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!

blup’s picture

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.

awolfey’s picture

subscribe

blup’s picture

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);
wesjones’s picture

subscribe

svenhs’s picture

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.

valante’s picture

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

valante’s picture

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

valante’s picture

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)

Primsi’s picture

subscribe

kirilius’s picture

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.

kirilius’s picture

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.

Steve Dondley’s picture

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";}}
phenaproxima’s picture

Any chance of a patch for this? I just ran into it, and the solution in #13 worked for me too.

AdrianB’s picture

Subscribing.

semperos’s picture

Here's code you can slap into a custom module to make #13 easy. Add this to your module, replace MY_MODULE with your module's name, and you'll be able to go to http://example.com/fix-fupload-preset to automatically fix this issue.

I've found that the problem "crops up" as I use this module, so I've coded the menu item as default so you'll see it in your Navigation if you have the 'administer site configuration' permission. Here's the code:

/**
 * Implementation of hook_menu().
 */
function MY_MODULE_menu() {
	$items = array();
	
	$items['fix-fupload-preset'] = array(
		'title' => 'Fix FUpload Thumbnails Preset',
		'page callback' => 'MY_MODULE_fix_fupload_preset',
		'access arguments' => array('administer site configuration'),
	);
	
	return $items;
}

/**
 * Custom callback to fix variable that messes up fupload thumbnails imagecache preset
 * 
 * In this example case, the name of my preset is 'teaser'
 */
function MY_MODULE_fix_fupload_preset() {
	$var = variable_get('image_node_types', '');
	$var['gallery']['imagecache_preset'] = 'teaser';  // 'teaser' is the name of my preset
	
	variable_set('image_node_types', $var);
	
	return t('Thumbnails should now be visible.');
}
igorik’s picture

@semperos - your code doesn't work for me, I added it into my util module but still no thumbnails.

Anonymous’s picture

Same to me, but there are some hints:

After several hours testing why there are no image Preview in the edit caption page. I add another imagecache preset named " editcaptions", and it works. My previous imagecache preset is only "200x200". Is the special character breaking the path??

By the way, remember to enable the imageAPI ;) just a friendly reminder.