Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Generic User Avatar

I can't use image folder


  • Please log in to reply
7 replies to this topic

#1 guitarzRus

guitarzRus

  •  Avatar image
  • Members
  • 30 posts
  • OFFLINE
  •  
  • Local time:10:04 PM

Posted 30 September 2022 - 07:41 PM

I have an image folder with image1.jpg in it. The folder I'm working in has image1.jpg in it
I write a program to display image1.jpg using: <img src="image1.jpg" height=250 width=250> .
Works.
I change the code to <img src="images/image1.jpg" height=250 width=250> . The image isn't displayed.
why?



BC AdBot (Login to Remove)

 


#2 Chris Cosgrove

Chris Cosgrove

  •  Avatar image
  • Global Moderator
  • 28,257 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:06:04 AM

Posted 02 October 2022 - 05:21 PM

The obvious answer is that the addition of the word 'images/' in your second version is causing the confusion to your site.. Since, on my understanding, image 1 is already in the folder you are working with you are directing the software to a different location to fetch it.

 

Chris Cosgrove



#3 guitarzRus

guitarzRus
  • Topic Starter

  •  Avatar image
  • Members
  • 30 posts
  • OFFLINE
  •  
  • Local time:10:04 PM

Posted 02 October 2022 - 05:33 PM

The issue is why must I paste an image from the image folder into the folder I'm using? If I remove it from the folder I'm using, 

<img src="images/image1.jpg"> doesn't work. Neither does <img src="../images/image1.jpg">



#4 Chris Cosgrove

Chris Cosgrove

  •  Avatar image
  • Global Moderator
  • 28,257 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:06:04 AM

Posted 03 October 2022 - 05:34 PM

On that point of nitty-gritty detail I do not know the answer. All I do know is that I wanted to use a very fine summery feel image on the home page of a small web-site I run and unless the image was in the build folder it wouldn't load into the build. So, rather than faff around seeking a reason and because I just wanted the site to work, I moved the image into the build folder.

 

Chris Cosgrove



#5 guitarzRus

guitarzRus
  • Topic Starter

  •  Avatar image
  • Members
  • 30 posts
  • OFFLINE
  •  
  • Local time:10:04 PM

Posted 03 October 2022 - 09:12 PM

yeah that's what I did but I want answers.



#6 xBlueRobot

xBlueRobot

  •  Avatar image
  • BSOD Kernel Dump Expert
  • 416 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:04 AM

Posted 26 October 2022 - 11:13 AM

We can't provide answers if you don't provide at least the directory tree of your site. Again, as I've mentioned to you previously, I would suggest opening your browser developer tools and then checking where it is attempting to load the image from. You should receive a 404 response for that particular file along with the path it is attempting to resolve.



#7 xBlueRobot

xBlueRobot

  •  Avatar image
  • BSOD Kernel Dump Expert
  • 416 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:04 AM

Posted 26 October 2022 - 11:15 AM

W3Schools provides some documentation on how to properly reference your image paths. It looks like you've just blindly copied that without understanding what it means.



#8 SamHobbs

SamHobbs

  •  Avatar image
  • Members
  • 72 posts
  • OFFLINE
  •  
  • Local time:10:04 PM

Posted 26 October 2022 - 05:48 PM

I think it depends on the server software you are using and you do not tell us. It might be that you need to use:

<img src="~/images/image1.jpg">

However you say you have an image folder and that images/image1.jpg does not work. Are you sure you are using the correct name?






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users