I'll try get you up to speed and keep it in scope .. I have a Joomla site with a SEF extension that only supports absolute image linking (relative links result in bad URLs). The SEF extension developers are looking into the issue.
Problem being, the site is live and I would really like a 'quick fix' until then (without disabling hundreds of SEF URLs).
Right, I've sorted out all of the sites image URLs except for one module from RocketTheme. Here's the code snippet that produces the image URL:
<img src="<?php echo $item->thumb;?>" alt="<?php echo $item->title; ?>"<?php echo $size; ?> />
I've tried changing it to the following, although a relative URL is still produced:
<img src="http://digital-diy.com/<?php echo $item->thumb;?>" alt="<?php echo $item->title; ?>"<?php echo $size; ?> />
Could someone please 开发者_StackOverflow社区help me with producing an absolute URL from the above code?
Assuming that the $item->thumb
variable contains a string along the lines of ../../images/some_image.png
, you could do this:
$components = pathinfo($item->thumb);
$image = $components['basename'];
That will give you the name of the file.
http://php.net/manual/en/function.pathinfo.php
精彩评论