problem in dispalying Image

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
samir_gambler
Forum Newbie
Posts: 19
Joined: Wed Mar 31, 2010 9:03 am

problem in dispalying Image

Post by samir_gambler »

am facing problem in displaying image....As when the image source is in the form of http://....its working but when its in the form of C:\wamp\www..... its not working ...Plz help me...
working code

Code: Select all

echo '<td align="center" width="25%"><a title="'.$row[0].'" href="' . $link . '"><img src="http://localhost/Joomla_1.5/administrator/components/com_gallery/uploads/tb_60.jpg" height="66" width="90" alt="Painting" border="0" /><br /><br/>
' . $row[0] . '</a></td>';
Not working code

Code: Select all

$path = JPATH_ADMINISTRATOR.DS. 'components'.DS.$option.DS.'uploads'.DS.'tb_60.jpg';// or $path = "C:/wamp/www/Joomla_1.5/administrator/components/com_gallery/uploads/tb_60.jpg";
echo '<td align="center" width="25%"><a title="'.$row[0].'" href="' . $link . '"><img src="' . $path. '" height="66" width="90" alt="Painting" border="0" /><br /><br/>
' . $row[0] . '</a></td>';
Can any1 plz modify my not working code.....as i m using this code in joomla therefore JPATH_ADMINISTRATOR gives the actual path which is like "C:/wamp/www/...." therefore i cannot use http method which is working
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: problem in dispalying Image

Post by Christopher »

The path C:/wamp/www/Joomla_1.5/... is not a valid URL. It is a system file path.

PS - Please spell out all words, so "Can anyone please" in stead of "Can any1 plz" so everyone can understand your question.
(#10850)
samir_gambler
Forum Newbie
Posts: 19
Joined: Wed Mar 31, 2010 9:03 am

Re: problem in dispalying Image

Post by samir_gambler »

As mentioned earlier my image is in C:/wamp/www/Joomla_1.5/administrator/components/com_gallery/uploads/tb_60.jpg. As u said its not a valid URL. It is a system file path. So can u give me the valid URL to it so that i can display the images in this folder. THANKS
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: problem in dispalying Image

Post by JakeJ »

You already had the valid URL. that's what you said was already working.
User avatar
Architek
Forum Commoner
Posts: 44
Joined: Wed Jul 01, 2009 5:01 am
Location: Portland OR

Re: problem in dispalying Image

Post by Architek »

since the variable is pre defined when its pulled you could run a replace on the system path section and replace with an http...

$path = "C:/wamp/www/Joomla_1.5/administrator/components/com_gallery/uploads/tb_60.jpg";
$path =str_replace("C:/wamp/www", "http://localhost", $path);
Post Reply