Page 1 of 1

problem in dispalying Image

Posted: Sun Apr 04, 2010 11:45 am
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

Re: problem in dispalying Image

Posted: Sun Apr 04, 2010 12:45 pm
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.

Re: problem in dispalying Image

Posted: Sun Apr 04, 2010 9:41 pm
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

Re: problem in dispalying Image

Posted: Mon Apr 05, 2010 1:44 am
by JakeJ
You already had the valid URL. that's what you said was already working.

Re: problem in dispalying Image

Posted: Mon Apr 05, 2010 2:27 am
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);