Reputation: 183
SOLVED: I used a relative path to folder.
Please help me understand why I can't display images in Joomla in such a way:
$path= JURI::root();
$previewImgPath = $path.'images'.DS.'folder'.DS.'images'.DS.$id.'/folder';
I got:
Warning: opendir(http://www.domain.com/joomla/images/folder/images/4/folder/) [function.opendir]: failed to open dir: not implemented in ... on line 61
What way is correct to display images using PHP?
Upvotes: 0
Views: 178
Reputation:
JURI::root()
returns the base URL of the site. To get the base path of the site, use JPATH_BASE
or an equivalent for the appropriate version instead.
Upvotes: 1
Reputation: 16062
You can't open a dir with HTTP.
Use something like :
opendir($_SERVER['DOCUMENT_ROOT'].'/joomla/images/folder/images/4/folder/');
Upvotes: 0
Reputation: 13257
You have to use a relative path to a directory, something like images/folder/images/4/folder/
. opendir() doesn't work with HTTP resources.
Try this:
$path= JURI::base();
$previewImgPath = $path.'images'.DS.'folder'.DS.'images'.DS.$id.'/folder';
Upvotes: 0