0

First off I apologise if this is the wrong SE community to post this on, however since it is the software package I use I hoped you guys could help me out.

I have set up a couple of image upload directories for me to use, one being for static images used over the site and another for images relating to articles posted on the site. I currently have a custom directory set up for static images at <root>/img/<imagename> which works perfectly fine when directly linked to in the template. However, this is not an ideal solution since I would need to manually manage images.

The problem effects both upload directories and new ones, but I will refer to the directory used for the static images for convenience unless noted. The logo which is used in the custom directory was also uploaded to the new ExpressionEngine upload directory, however when it is accessed nothing will appear. Any links to the image will show up as the broken image icon, and opening the image link directly will just produce a blank screen.

News article images are stored at <root>/news/images/<newsimage>. At the same time news articles themselves are stored/displayed at <root>/news/article/<channelcontent>. This suffers the same issue as the static image directory, however opening a direct link to one of the images will load up the news overview section of the site, the homepage of the /news/ section. In short, it effectively ignores the image and displays the news homepage instead, as the image below demonstrates.

Screenshot showing images displaying incorrectly

(the second black box at the bottom happens all the time, not just in this particular scenario).

You can see that while hotlinking to the image, I get redirected instead of showing an image. Below, you can also see that the images hotlinked alongside the articles do not display, instead showing a broken image icon.

The same issue does not occur just in the articles, but also in the editor!

Screenshot showing broken image in editor

I instantly assumed it was a server permissions error, but following the guide I set the image and folder permissions to 755 and even 777, but the bug remains present.

The following is the setup for the news image directory.

Descriptive name: News Images
Server path of upload directory: /home/<hidden>/public_html/beta/img/news/
URL of upload directory: http://beta.bowl-of-soup.co.uk/news/images/
Images only

And this is how it is used in the broken images above.

{exp:channel:entries channel="news" limit="10"}
<hr />
<h4><img class="left" src="{news_headimg:thumb}"/><a href="{url_title_path='news/article'}">{title}</a></h4>
<p><i>A wonderful testing article by your adoring {author}</i></p>
<p>{news_headline}</p>
{/exp:channel:entries}

(Removing :thumb makes no difference).

Please can anyone help with this issue? I can provide more details happily as this issue is a blocker in the site development. I tried searching multiple solutions but none seemed to work.

ExpressionEngine covers the whole site at , so please check it out to see the bug first-hand (advertising not intended - I'll switch off adverts until the issue is resolved).

2 Answers 2

0

I think your problem is that your server path and URL are pointing to different places. The end of these paths should match. Try the following:

Server path of upload directory: /home/<hidden>/public_html/beta/img/news/
URL of upload directory: /img/news/

Accessing http://beta.bowl-of-soup.co.uk/img/news/blank.jpg works fine, so I think the problem is just that the image URLs are being output as at the moment because the URL of the upload directory does not match the true location on the server.

1
  • I had no idea that the paths had to be the same! I assumed the .htaccess would rewrite the absolute path so you could define a custom location. It's clear I need to research this technology further, but thankfully the images are now displaying properly. Thank you both for your help with this issue - I appreciate it deeply.
    – soup-bowl
    Aug 15, 2014 at 22:34
0

There is a setting in expressionengine to change the url path of images. This sounds like it may be your problem. If you go under Content -> Files -> File upload preferences, and you edit the file url path "URL of Upload Directory". This is what is ExpressionEngine uses for the path of your images in your templates. If this is incorrect, then you get a broken image even if the files are in the incorrect path on your server.

So in your case, it looks like you need to change the URL of Upload Directory for that particular upload path to "/news/images/" without quotes.

1
  • Thanks for the help, I amended both file uploads but both of them still do not display any images even with the URL shortened. Any more ideas? Just to confirm, 'beta.bowl-of-soup.co.uk/news/images' is now just '/news/images/'.
    – soup-bowl
    Aug 13, 2014 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.