Does anyone know of a way to upload an image from their own computer within Drupal 7, so that the image is displayed in an Article or Basic Page?

Failing a reply to that question, I am trying to tackle the problem myself but am now stumped.

I am currently using Drupal 7 RC2; have installed the WYSIWYG module; and have downloaded FCKeditor 2.6.6.

When I create a Basic Page and press the Image Upload button. I have the option to browse my computer for an image (I have added some code that allows me to do this).

Once the image gets uploaded it would normally get stored at /userfiles/, which is not very helpful really. I have managed to change the code that sends the image to /userfiles/, so that it gets sent to sites/default/files/styles/large/public/field/image/.

To redirect the image I changed one line of code within fckeditor\editor\filemanager\connectors\php\config.php

$Config['UserFilesPath'] = '/xampp/[website_name]/sites/default/files/styles/large/public/field/image/';

The image gets sent to the desired location, but once I save the page and attempt to view it the image doesn't get displayed, but if I was to edit the page again, the image is visible again.

Example #1 image shows the image within the editor:
http://alannotton.co.uk/images/Drupal/Example1.gif

Example #2 image shows the image not visible when viewing the page.
http://alannotton.co.uk/images/Drupal/Example2.gif

Any guidance would be much appreciated.

Alan

Comments

Carolyn’s picture

Have you checked if your input filter allows the img tag? Try the input filter for Full HTML.

comicsal’s picture

I would if I knew how :-)

I have checked Configuration » Content authoring » Text formats » Full HTML » Configure, and looked under Enabled Filters to reveal the following.

disabled - Limit allowed HTML tags
disabled - Display any HTML as plain text
enabled - Convert line breaks into HTML
enabled - Convert URLs into links
enabled - Correct faulty and chopped off HTML

Is this what you mean?

I have also tried to use the Configuration » Media » File System section and type in my required file destination into the Public File System Path. Now, this has the ability to create a new folder (i.e. cuk4/sites/default/files/styles/thumbnail/public/field/image/), but it will not place the image within this folder. Maybe there is a special Drupal Session Variable for an image name that I don't know about.

Thanks for your help.

Carolyn’s picture

Under a piece of content, there is a link called "input format". Open that and choose "Full HTML". See if your image shows up now.

comicsal’s picture

I tried that (thank you), but it resulted in the same problem. No image being displayed when viewing the article.

I have been trying all different combinations of FCKeditor. CKEditor and CKFinder and tweaking the code for the past few days now, all to no avail.

I got this to work quite easily in Drupal 6. But Drupal 7 in proving to be a bit of a beast with Image/File uploads.

Have you (or anyone on planet Earth), using Drupal 7, actually managed to:

  1. Write an Article (or Basic Page)
  2. Press the Image Upload button on the toolbar
  3. Upload an image from your own computer
  4. Save the Article
  5. View the Article and have your uploaded image displayed within the Article

Fingers crossed for a positive guide in the right direction.

KingOfMyCastle’s picture

I had more luck using IMCE.

Add it to your wysiwyg buttons. It does have an error when you upload an image but then you can go to the normal image browser and the image will be sitting on your server.