Reputation: 4244
I want to embed picture on page with script, so I need either path like
domain.com/fms/fms_theme/images/no_hos_photo.png
or
/fms/fms_theme/images/no_hos_photo.png
The question is, how to get one of these from
/var/www/flyer/data/www/domain.com/fms/fms_theme/images/no_hos_photo.png
which is
dirname(__FILE__)
The thing is, domain is unknown, path is unknown, the only certain thing that picture is in
/fms_theme/images/
Upvotes: 0
Views: 123
Reputation: 324600
Try this:
$path = "/var/www/flyer/data/www/domain.com/fms/fms_theme/images/no_hos_photo.png";
$relative = substr($path,strlen($_SERVER['DOCUMENT_ROOT']));
Upvotes: 4