Images Are Missing

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Images Are Missing

Postby MyWorld » 10. October 2010 02:20

I downloaded a copy of my site to the htdocs folder, everthing works fine except I can't see the images. The images on the live site uses a relative path so I assume that's why this is happening. On my local server it's looking for the images using this path: http://127.0.0.1/images/myimage.gif but the correct path on my local server is http://127.0.0.1/mysite/images/myimage.gif

Is there something I can do to fix this so that when I upload the site I don't have to change all the paths again.

Thank you!!
MyWorld
 
Posts: 10
Joined: 07. October 2010 19:42

Re: Images Are Missing

Postby JonB » 10. October 2010 02:35

Other than the obvious "create that folder and copy the files over there", there are some more exotic things you could do.

Alias is the 'correct' Apache solution I suppose:

http://httpd.apache.org/docs/current/mod/mod_alias.html

read down a bit to the Alias Directive part.

you would put your Alias directive in the \apache\conf\httpd.conf file in teh <IfModule alais_module> section. Thye give an almost dead-on example.


Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Images Are Missing

Postby MyWorld » 12. October 2010 22:27

Sorry I have no idea what I should be doing. I assume I need to add this line "Alias /image /ftp/pub/image" in the <IfModule alias_module> below?

Code: Select all
<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://localhost/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.
   Alias /image /ftp/pub/image

    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/"

</IfModule>
MyWorld
 
Posts: 10
Joined: 07. October 2010 19:42

Re: Images Are Missing

Postby Nobbie » 12. October 2010 22:42

MyWorld wrote:I assume I need to add this line "Alias /image /ftp/pub/image" in the <IfModule alias_module> below?


I dont think that this works correctly. Or, does it?
Nobbie
 
Posts: 8759
Joined: 09. March 2008 13:04

Re: Images Are Missing

Postby MyWorld » 12. October 2010 22:51

No it doesn't work. :(
MyWorld
 
Posts: 10
Joined: 07. October 2010 19:42

Re: Images Are Missing

Postby JonB » 13. October 2010 00:23

It doesn't work because your images aren't in "/ftp/pub/image"

in living color - here is a working example:

Code: Select all
   # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.
   Alias /aliased-images/ "C:/xampp/htdocs/images-2/"
    #

three URLS:
http://bravo.newnetenterprises.com/design-tests/ (where innoDB-2.png is embedded in a page with its true URL - get its properties - its in images-2)
http://bravo.newnetenterprises.com/alia ... noDB-2.png
and finally all by tiself:
http://bravo.newnetenterprises.com/imag ... noDB-2.png

C'est bon. no? :D
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Images Are Missing

Postby MyWorld » 13. October 2010 14:05

OK please bear with me but this still isn't working. I'm probably totally misunderstanding what you are trying to tell me. I tried the following:

Alias /aliased-images/ "C:/xampp/htdocs/mbc/"
Alias /aliased-images/ "C:/xampp/htdocs/"
Alias /images/ "C:/xampp/htdocs/mbc/"
Alias /images/ "C:/xampp/htdocs/"

"mbc" is one of the folders that I have in the htdocs so I add it to the path to see if that would work. I'm hoping to have it work so that any website folder that gets added to the htdocs the images will automatically show.

Thanks!!
MyWorld
 
Posts: 10
Joined: 07. October 2010 19:42

Re: Images Are Missing

Postby JonB » 13. October 2010 14:53

1st - where is the folder 'mysite' on your local server? (and WHY is there a 'mysite' folder? - MAYBE that should be your DocuemntRoot)

give the whole path -

IF it is under c:\xampp\htdocs, the alias would be

Alias /images/ "C:/xampp/htdocs/mysite/images/"

Be aware - you CAN'T have both a 'real' and an aliased object with the same name.

so you can't have an alias for "images" in htdocs and a real folder with the same name - that would break the fully qualified URI rules - each resource must have a uniquely identifiable address. There can be two of 'you', right? too confusing... the same for URL's

Alias simply means 'another name for'.

As I pointed out in my first post, you also could probably create a folder called images and move all the files there. If there is already a folder with that name, just copy the needed files into it.

I hope this is helpful
:shock:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Images Are Missing

Postby JenifferMilers » 30. October 2010 07:46

The thing is that the images don't display if the connection is http. Therefore, whenever I open a new spreadsheet (conveniently in http format)
JenifferMilers
 
Posts: 6
Joined: 30. October 2010 07:38

Re: Images Are Missing

Postby boskom » 30. June 2011 21:23

That is not necessarily true, and I will prove it for you!!
boskom
 
Posts: 1
Joined: 14. June 2011 11:46

Re: Images Are Missing

Postby JonB » 01. July 2011 01:17

wow - a spammer to spammer argument evolves over time...

:shock:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 56 guests