LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 07-05-2012, 02:40 PM   #1
Usalabs
Member
 
Registered: Jan 2004
Distribution: Ubuntu Lucid (LTS)
Posts: 111

Rep: Reputation: 15
How do I get local htdocs images to show on a web page.


I couldn't put too much in the subject line.

I'm running OpenSuSe 11.4 with apache, mysql and php already serving up php based sites from the apache document root htdocs, inside the doc root are 2 folders (excluding the folders for the php sites) cgi-bin and images, now the problem is, for some reason basic html pages are not showing images from the images folder, using <image src="images/pic.gif> I even prefixed images with a / but nope, all that gets shown on the pages are the image place holders, unless I use the full url, ie <image src="http://address/images/pic.gif"> and yet I have seen the page sources of other websites that actually use an images folder,,, but how?

Also, if I used Kompozer to create web pages, how would I set that up to publish to my doc root, being that apache doc root uses root:root access, and vsftp does not allow local or external root access, which means I would have to publish to a user space, which would defeat the object of having an htdocs folder, and publishing using Kompozer is not like using MS Front page, Kompozer does not publish the entire site, just the html pages created, which means to put pages and images in the htdocs and images folder, I have to use webmin upload/download manager.
 
Old 07-05-2012, 03:11 PM   #2
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Well,

If you can put here some of your configuration files, then someone can see what is the problem and may help.
The files would be primarily "Apache" configs (in OpenSuse /etc/apache2/httpd.conf and default-server.conf )

Last edited by lithos; 07-05-2012 at 03:33 PM.
 
Old 07-05-2012, 05:11 PM   #3
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,971

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Hi,

You miss the closing double quotes in the image URL. It should be
Code:
<image src="images/pic.gif">
Regards
 
Old 07-05-2012, 05:39 PM   #4
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by bathory View Post
Hi,

You miss the closing double quotes in the image URL. It should be
Code:
<image src="images/pic.gif">
Regards


Now who's the Hawkeye !
 
Old 07-06-2012, 05:05 AM   #5
Usalabs
Member
 
Registered: Jan 2004
Distribution: Ubuntu Lucid (LTS)
Posts: 111

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by lithos View Post


Now who's the Hawkeye !
Typos are easily created lol, but in mmy case I checked the html code, and the location is enclosed in 2 double quotes


I'll post my Apache conf files here,,,, they maybe a bit big, soooo, maybe I should use pastebin instead.
 
Old 07-06-2012, 05:25 AM   #6
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by Usalabs View Post
...
maybe I should use pastebin instead.
..Good idea !,
or attach to the post (as config_file.txt or something).
 
Old 07-06-2012, 05:46 AM   #7
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,971

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Quote:
Originally Posted by Usalabs View Post
Typos are easily created lol, but in mmy case I checked the html code, and the location is enclosed in 2 double quotes

I'll post my Apache conf files here,,,, they maybe a bit big, soooo, maybe I should use pastebin instead.
So it was a typo. Well, I don't think it's an apache configuration problem as you see the broken images placeholder.
Better have a look at apache error_log to see where it looks for the images.
Also since you use ftp to upload stuff in your webserver, make sure you're using binary mode to transfer images

Regards
 
Old 07-06-2012, 09:36 AM   #8
Usalabs
Member
 
Registered: Jan 2004
Distribution: Ubuntu Lucid (LTS)
Posts: 111

Original Poster
Rep: Reputation: 15
Here's my httpd.conf and default-server.conf renamed with the txt extension because this forum don't allow .conf files.

Also the Apache error.log shows:-

File does not exist: /srv/www/htdocs/images/logo.gif referer: sites_blocked.html
File does not exist: /srv/www/htdocs/images/logo2.gif referer: sites_blocked.html

Both files exist in /srv/www/htdocs/images and are 755 permissions.

I can't insert the html tags used because for some unknown reason, this forum replaces them with the http address for linuxquestions.org like this:-

Code:
<image src="http://www.linuxquestions.org/questions/images/logo.gif">
<image src="http://www.linuxquestions.org/questions/images/logo2.gif">
Ignore the linuxquestions.org line,,, it's what this forum has inserted.

I even tried relative to the doc root by prefixing images with /
Attached Files
File Type: txt httpd.txt (8.6 KB, 4 views)
File Type: txt default-server.txt (3.5 KB, 4 views)

Last edited by Usalabs; 07-06-2012 at 09:55 AM.
 
Old 07-07-2012, 11:55 AM   #9
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,971

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Quote:
File does not exist: /srv/www/htdocs/images/logo.gif referer: sites_blocked.html
File does not exist: /srv/www/htdocs/images/logo2.gif referer: sites_blocked.html
How are you visiting your site? The referer should look something like:
Quote:
referer: http;//servername/sites_blocked.html
 
Old 07-07-2012, 01:29 PM   #10
Usalabs
Member
 
Registered: Jan 2004
Distribution: Ubuntu Lucid (LTS)
Posts: 111

Original Poster
Rep: Reputation: 15
It does show the referer as http://FQDN:port/sites_blocked.html :port is shown because Apache has to be running on a non-standard port, being that my ISP blocks incoming on port 80, and I have to use a dynamic host name service, but Apache should still be able to use the local images directory, when using <image src=> tag.

That page only gets refered to by squidguard redirector when a site is blocked.

Last edited by Usalabs; 07-07-2012 at 01:32 PM.
 
Old 07-09-2012, 12:59 PM   #11
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,971

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Quote:
I have to use a dynamic host name service, but Apache should still be able to use the local images directory, when using <image src=> tag.
Of course it should. What happens if you use: http://FQDNort/images/logo.gif
 
Old 07-09-2012, 08:52 PM   #12
Usalabs
Member
 
Registered: Jan 2004
Distribution: Ubuntu Lucid (LTS)
Posts: 111

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
Of course it should. What happens if you use: http://FQDN:port/images/logo.gif
Using an FQDN:port in the url, does show the image perfectly.
 
Old 07-09-2012, 10:27 PM   #13
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Mageia, Mint
Posts: 8,230

Rep: Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552
You syntax for relative links is incorrect.

See here for how to do relative links: http://www.bio.davidson.edu/courses/...tivelinks.html
 
Old 07-10-2012, 08:53 PM   #14
Usalabs
Member
 
Registered: Jan 2004
Distribution: Ubuntu Lucid (LTS)
Posts: 111

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by frankbell View Post
You syntax for relative links is incorrect.

See here for how to do relative links: http://www.bio.davidson.edu/courses/...tivelinks.html
I'm not actually using clickable links, but image sources, when the properties of an image is looked at, it should show "http://www.linuxquestions.org/questions/images/logo.gif" and not an FQDN, the <img src=> tag source should be relative to the document root, but for some reason relative image sources are not being used, but instead Apache always wants to use an FQDN in the <img src=> tag.
Code:
<p><img src="logo.gif" /><br /></p> 
<p>more stuff</p>
This is one of the lines in the html file called sitesblocked.html, but if the page is called from a redirector such as squidguard using a relative source, only the image place holder is shown, but if I use an FQDN in the <img src=> tag it works, the same goes for if I directly enter http://FQDN/images/image.gif in a browser, and the source tag is relative, only the place holder is shown, but use the same url and use an FQDN in the image source tag, it works.

What I want to happen (as I've seen on a lot of web page sources), when an image's property is examined, it shows images/image.gif as the source, not http://FQDN/images/image.gif

Last edited by Usalabs; 07-10-2012 at 08:56 PM.
 
Old 07-10-2012, 09:17 PM   #15
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Mageia, Mint
Posts: 8,230

Rep: Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552
Quote:
I'm not actually using clickable links, but image sources,
Regardless, a link is a link is a link and your relative links are not formatted correctly.

Here's an example of a correct one displaying a little map from this page on my boating site:

"../graphics/cbaythum.jpg"

(I had to leave out the img src= stuff because, when I left it in, LQ replaced the two periods with the path to LQ's parent directory.)

Note the two periods at the beginning of the relative path meaning "relative to the parent directory."

Last edited by frankbell; 07-10-2012 at 09:20 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Embed web cam images in web page secondhandman Linux - Newbie 1 06-30-2012 09:46 PM
[SOLVED] How do I use wget to download only images from a single web page? errigour Linux - Newbie 1 11-29-2011 07:57 PM
Quiery database and show results on a web page jlinkels Linux - Software 5 01-04-2007 08:26 AM
Cant make web server run my local web page... Nik0s Linux - Newbie 22 10-08-2006 11:30 PM
cannot view web page from local lan Tigger Linux - Networking 4 05-31-2003 02:03 AM


All times are GMT -5. The time now is 08:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration