Hi,

I'm sure this should be easy but I've not worked it out yet.

Imagine I have created a "Book" content type, and used CCK to create, Title, Author, ISBN, Description and Genre fields. Taht all works fine.

I now want to allow the users to attached a picture of the book too. So, I've enabled the Upload module and sure enough when creating content the user is presented with a File Attachements section.

I use the browse button to select the image file to upload and then press the Attach button. It uploads the file and gives a URL for the file.

Firstly if I put that URL into my browser I get a 404, so somethings not right there.

Secondly if another user views the Book they don't see the picture or any link to it.

How do I use the uploaded file(s)?

Thanks
Ben

Comments

danpen’s picture

http://drupal.org/project/imagefield provides an CCK image field, may also want http://drupal.org/project/imagecache which will autogenerate thumbnails.

cheers

Dan

JirkaRybka’s picture

As for regular attached files - make sure that anonymous (or whichever role is the target audience) users have permission to see the attachments, and that your .htaccess is not restricting the files (AND that you've download method set to public, and files directory properly set up).

As for experience with modules - I tried "Image attach" a while ago - that one did just show the picture instead of linking to it (I'm not sure if the module will be available for your Drupal version - check that first). But if you rather want to allow your users to insert images directly into the submitted posts, then I'll recommend the Image Assist module - this one gives a lot of options, including upload/formatting manipulation in a pop-up window.

You'll probably want to install Image module too, as it might be required by the otehr ones. It basically allows images to live as posts (rather than just attached files).

arh1’s picture

check out this lullabot article for a comparison between 2 different approaches.

in general, i'd recommend avoiding Image and Image Assist unless you explicitly want each image to be its own node (otherwise, they're adding unneeded complexity to your site).

JirkaRybka’s picture

Yes, I don't like images to be nodes, and had to hack a bit of code to stop people adding images separately, too... But even then, I *need* Image Assist, because it's really the only way of adding pictures, which is digestible for our end-users. We need images to be in-text and easily uploadable - an <img src="..."> tag is useless for end-users, if they don't have a way to upload, and having image file only just attached to the post (even with a thumbnail), without any chance to have it near the mention inside text, is really *not* good looking. It's a bit more complex, yes, but in the other way it handles well different image sizes (original size, site-wide uniform size, and thumbnail), and important thing is also re-usability of images: Image Assist first offers you a gallery of your previously uploaded images, which is often enough to illustrate a new article with already uploaded image, and saves a *lot* of disk space by avoiding duplicate uploads. Only if you *need* a new image, you can upload it, and format into text immediately as a thumbnail with nice caption and pop-up window showing full-size. We have also an option to browse images per-user through various Views-pages (although that is certainly a very minor feature on the site). So I think it's worth it. Drupal is complex by it's nature, BTW.

arh1’s picture

i hear you about relying on Image Assist as a "digestible" way for users to add images inline with other content. recently, i've started using IMCE to achieve a similar ease-of-use w/o having images be nodes.

yep, Drupal is complex by nature, but IMHO it's really smart to only add additional complexity in the form of contributed modules *as needed* (that is, to think hard about whether the additional functionality added by a contributed module is absolutely necessary). helps keep me sane, anyway ;)

BenS1’s picture

Thanks everyone for your advice.

I've just tried using the CCK ImageField and sure enough when adding content I am presented with the option to upload a file, which I do, however once I save the content and view it there is no sign of the image!

I've just looked in the images directory that the images should be upladed into and there's noting in there!

Any idea why the uplads aren't working?! There are no error messages when I do the upload, it appears successful but obviously its not!

Thanks for your help
Ben