By webcomm on
Hello,
I'm having a bit of a struggle with imagefield and imagecache. I want to be able to upload images and have those images automatically resized to suit my teaser layout. It seems like that is what imagecache is supposed to do, but I can't get it to work.
Meanwhile, it says on the imagefield page (http://drupal.org/project/imagefield) that imagecache is not well documented. Is there some other module that will do this for me, if not imagecache? I see that imagefied_crop will crop images, but I need something that will resize them on upload.
Many thanks,
Ryan
Comments
no imagefield
I guess the resizing problem pops up without imagefield and imagecahce, too. I've tried img_filter, and the resizing fails for large image dimensions. It depends on your memory limit, but f.e. a 3000x2000 px image can't pload, even if it's only 1-2 MB.
Doka
Doka
pload? Is that a typo? I've
pload? Is that a typo?
I've had no problem uploading images. I am working with small images. But the presets I define in imagecache have no effect on the image file... that is, the image does not get resized on upload.
The only thing in the presets that seems to have any effect is the namespace itself. The image is indeed getting uploaded to the path determined by the namespace, but isn't being transformed in any way.
Meanwhile, the image is being uploaded to two different paths. If I set the namespace to "apples", the image will upload to both...
http://example.com/files/imagecache/apples
and
http://example.com/files/imagecache/apples/files/imagecache/apples
Imagecache
Imagecache stores the original file as well as the resized file... Are you sure it's not resizing your images? Is it storing two full-sized versions, or is the one in the deeper directory the resized version? You should be able to create a view that will display the resized version as a test.
Also, the previous comment by doka is true... though it doesn't sound like you are running into this issue... If you ever do decide to upload larger images you will need to add this to your main drupal .htaccess file:
The 64mb is optional but it gives you the ability to upload really high quality images.
Thanks for the comment, it
Thanks for the comment, it works for 3000x2000 image dimensions.
Doka
Doka
Hello- Still having
Hello-
Still having problems. Here's what I did just now to test:
I created a latest_news namespace in imagecache to scale images for my News Story content type to 70px wide.
My News Story content type has an image field named field_image_latest_news. The path for the field is set to imagecache/latest_news in the interface at /admin/content/types/story/fields/field_image_latest_news
The Teaser menu in the interface at /admin/content/types/story/display is set to latest_news.
I created an image called photo_test_100.jpg on my desktop that is 100 px wide. If I go to /node/add/story and upload the image and save the item, I can see photo_test_100.jpg in my FTP program at /files/imagecache/latest_news/ -- If I download the image, it is still 100px wide.
I'm not seeing the additional directories I was seeing on friday. That is, there is no doubling of the directory structure to... /files/imagecache/latest_news/files/imagecache/latest_news/
I might have changed something on Friday after I posted in this forum.
When I look at the teaser variables for this content type in the contemplate module, the value for $node->field_image_latest_news[0]['view']

is...
So the path is doubled there, but that may be because imagecache isn't compatible with contemplate?
In any case, I don't see a resized image anywhere, though I've tried refreshing various likely locations in my FTP program. I'm not sure where I should look for the resized image.
-Ryan
One way to find out if there
One way to find out if there is an issue with your contemplate content is to try adding that field to a default content type like a page and see if it works when you submit an image that way.
But it does sound like there is still an issue with imagecache not actually creating the scaled down versions... The folder where my imagecache scaled versions are going on one of my sites is:
drupal_root/files/imagecache/my_preset_name/files/whatever
Whereas the full size originals go to:
drupal_root/files/whatever
So if the first dir isn't being created but the second is, there is a problem with imagecache.
If neither of them is getting any files I would check to make sure your upload dir is set properly at admin/settings/file-system . If you are on a local testing server you will have to change that accordingly, or if on a live server set it to /tmp or something.