473,788 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem in displaying image

52 New Member
Hey all,

I have a strange type of problem.

I have a simple code of html (say in test.html)
[HTML]<img src="/home/Shreedhan/edited_shreedha n2.jpg" />[/HTML]

If I put this code in a separate file and open it directly, it works fine.

But if I open same file in apache ( i mean like "localhost/test.html")
then, it doesn't show the image at all

Isn't that strange?
Is there any solution to this
Dec 30 '07 #1
5 1719
Markus
6,050 Recognized Expert Expert
Is the image located in your htdocs?
Dec 30 '07 #2
shreedhan
52 New Member
Yeah, the image I am trying to display using PHP is located in /var/www/html/uploads/shreedhan

I have tried displaying other images which are in /home/shreedhan directory as well. But its not displaying other images also.
I have given the complete path in the 'src' attribute
Further I have given read, write and execute permissions to the /var/www/html/uploads/shreedhan directory

Thanks
Dec 30 '07 #3
shreedhan
52 New Member
Hey,

I got a temporary solutiong for my problem.
Instead of giving full path of the image like
[HTML]<img src="/var/www/html/uploads/shreedhan/sth.jpg" />[/HTML]

I included followin line[HTML]<img src="http://localhost/uploads/shreedhan/sth.jpg" />[/HTML]

It displays the image properly.
But what if I have to include images from other directories than /var/www/html

Thanks
Dec 31 '07 #4
Markus
6,050 Recognized Expert Expert
Hey,

I got a temporary solutiong for my problem.
Instead of giving full path of the image like
[HTML]<img src="/var/www/html/uploads/shreedhan/sth.jpg" />[/HTML]

I included followin line[HTML]<img src="http://localhost/uploads/shreedhan/sth.jpg" />[/HTML]

It displays the image properly.
But what if I have to include images from other directories than /var/www/html

Thanks
So, i'm guessing this works too:
<img src="uploads/shreedhan/sth.jpg" />

The reason the pics arent working is because you're going away from your htdocs. To use pics from elsewhere on your pc use the direct path to that.

e.g
[php]
C:/xampp/htdocs/images/DockEdit.jpg
C:/some_dir/another_dir/_images/image.jpg
[/php]
Dec 31 '07 #5
shreedhan
52 New Member
So, i'm guessing this works too:
<img src="uploads/shreedhan/sth.jpg" />
Yeah this also works.

The reason the pics arent working is because you're going away from your htdocs. To use pics from elsewhere on your pc use the direct path to that.

e.g
[php]
C:/xampp/htdocs/images/DockEdit.jpg
C:/some_dir/another_dir/_images/image.jpg
[/php]

Actually, I am providing full path. I use linux so the path for the image starts from root '/'.
/var/www/html is the default directory to host webpage (as it is htdocs in case of windows)
Even though I provide full path '/var/www/html/uploads/shreedhan/edited_shreedha n2.jpg' , it's not showing the image.
But if I provide 'uploads/shreedhan/edited_shreedha n2.jpg', it's showing the image, because it's in the same directory where pictures.php (the file with including above images) is stored.

I haven't been able to include images outside of /var/www/html
Dec 31 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
2227
by: Kingdom | last post by:
I'm using this script to dynamicaly populate 2 dropdowns and dispaly the results. Choose a component type from the first drop down, lets say 'car' and the second box will list all the car 'manufacturers' and the display will then provide all the rest of the info from the other fields. I need to eliminate all the duplicates in the First Drop Down as it currently displays an entry for every record, many are identical, I might have over...
11
1987
by: Ian Davies | last post by:
Hello Im having problems displaying my images as thumbnails in a table. My code for producing the new width and height from the original image is as follows ************************************************** if ($ImagePath) { //$Image = WEB_ROOT . 'images/PupilTester/' . $ImagePath; $Image = 'images/PupilTester/' . $ImagePath; } else { $Image ='images/PupilTester/nopicture.bmp'; }
3
1358
by: Irfan Akram | last post by:
Hi Guys, I am having problems displaying an image from the database, that alreday has been uoploaded successfully. The image loads in correctly, but by default it is displayed on the whole page. I want it to bde displayed on some part of the page. I was able to do that if I used img.ImageUrl, for images stored on my hard drive, but I want to view it from anywhere my site is sccessed, hence I decided to get it loaded directly from...
3
2251
by: c676228 | last post by:
Hi everyone, I have a piece of code in sales.aspx.vb like this: Protected WithEvents Message As System.Web.UI.WebControls.Label Try ... ChartImage.ImageUrl = "ChartGenerator.aspx?" + DataStr + "&ChartType=" + drpChartType.SelectedItem.Value.ToLower() + "&Print=" + printVersion.ToString() ... Catch e As Exception
4
2183
by: comp.lang.php | last post by:
'll try to explain this as clearly as possible, sorry if it's unclear. You have in your directory /foo 42 images You have in your database metadata for 30 out of those 42 images You have to display all 42 images in the /foo directory whether they have database metadata or not. If any of the 42 images have metadata, you must display the metadata,
14
9507
by: Brad | last post by:
I have a .net 2.0 web application project that creates a pdf file, saves the pdf to disk (crystal reports does this part), and then my code reads the pdf file and writes it to the httpresponse The web app works great on win2003 and xp and the end result is a pdf file is displayed in the browser. When I run the same code on Vista, the browser displays the message "Internet Explorer cannot display the web page". If I open the same...
4
2110
by: =?Utf-8?B?Qkw=?= | last post by:
I am in a problem to access user control(.ascx) on a .aspx page the following is my scenario I have following directory structure - Autoboom - workshop -- WSFirst -showroom
4
1688
by: shahidrasul | last post by:
i display a pic on picture box and then i want to display another pic after some seconds but problem is that first image is not displaying only display 2nd image 1... display first picture from database such as pbThumbImage.Image = new Bitmap(new MemoryStream(objEmployee.Picture)); 2... and then get the reference of current main thread Thread main = Thread.CurrentThread; Thread.Sleep(5000);
3
7746
by: mvijayrkumar | last post by:
Hi to all.... Guys pls help me..... I have an image issue in RLDC while hosting my project on server.The image displays or works fine with the local system.But when hosted on server,both the images(One coming from DataSet and another from my project image folder) not displaying. Both images are having Type property External and the Values are given correspondingly.ie The One coming from Image Folder;using the Report Parameter ,the...
6
1996
by: vikidigi | last post by:
PLz Help i have some Images in DataBase in Blob field but images are displayed with a Cross (X) not the actual image MainPage.php//code # <?php # $con = mysql_connect("localhost","root",""); # if (!$con)
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10118
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5403
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.