Delicja
Delicja

Reputation: 183

Why can't I display images in such a way?

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

Answers (3)

user1233508
user1233508

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

eric.itzhak
eric.itzhak

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

Jeroen
Jeroen

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

Related Questions