Hi,
I've followed the instructions at: http://www.lullabot.com/articles/image_and_image_exact_sizes_vs_imagefie...
but I don't see any "imagecache" subdirectory within my "files" dir.
Here's what I've done:
1. Installed the Image Field and ImageCache modules
2. Created my image cache namespaces
3. Created a new content type with one "Image" field
4. Created a view for the content type from step 3, and choose my namespace from step2 as the Image Field option
5. Created a custom tpl for my new content type (node-content_news.tpl.php)
6. Changed my files/.htaccess to:
#SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options +FollowSymLinks
But when I go to create a new node, and upload the image, the image does not show up in the admin preview, nor does it show up in the user page.
I notice in the admin preview, that the image URL it's trying to use is: .../files/blah.jpg . But from reading instructions from other tutorials, they say the imagepath should be: files/imagecache/mypresetname/....
When I look in my "files" directory, there is no imagecache subdirectory. When is that directory supposed to be created?
Thanks for the help
Comments
can you post the contents of
can you post the contents of your node.tpl.php that you created with the line you are calling the images, should look something like this.
theme('imagecache', 'preview', ${$default_field_name.$i}[0]['filepath']);Here is the line in
Here is the line in question:
print theme('imagecache', 'articleimages', $node->field_news_image[0]['filepath']);
'articleimages' is the imagecache namespace, and field_news_image is the name of the CCK Image field for my custom News node.
When I'm uploading an image, through the Create Content->My News section, after uploading the file, the preview screen is trying to access the uploaded file from the 'files' directory. But shouldn't that be files/imagecache/articleimages ? Why doesn't that imagecache subdir exist, and when is that created? Are the subdirectories created when a new namespace is created?
Thanks
$node not required
I beleive the $node is not required so you can just use $field_news.... but this probably wont fix anything.
This is how I believe it works.
The print theme prints out the url of the photo which is made up of a file path. The menu call back system detects this filepath 'imagecache/....' (mod_rewrite must be configured with the -f in the apache configuration otherwise it will not work, this happened to me. -f for file path rewrite or something) when this filepath is detected it then calls the imagecache functions which do the work. If the paths dont exist it then creates them and the images, else just they have already been created so do nothing. Therefore when you flush the cache it deletes the lot and the next time the page is called print theme.... sets off the menu call back to create the cache again.
Make sure you have commented out print $content. This will automaticly be trying to print out the one from the /files/xxx.jpg .
views has nothing to do with the pics displaying on the basic node page. if you can get them going here then views is the next step which should just work.
sub directories are only created when the images are accessed by a browser for the first time.
oh and if its a windows server your using then goodluck, i had major issues with the files directory permissions always reverting to read only and not allowing the imagecache directorys to be created. Windows = the biggest virus in the world ;-)
hope this helps a little
organic groups conflict?
This is really strange... when I disable the Organic Groups module, then file attachments and imagecache works! When og is enabled, it doesn't work.
Any reasons why this might be?
Thanks
Don't know about OG, but...
I manually created a directory tree for imagecache under /files, and changed the permissions. "View source" on your nodes and you'll see the directory structure Drupal wants for imagecache images.
When I did this, images were created correctly. No idea why Drupal couldn't create these directories itself.