Add a slash before the address link to the image

Phoca Maps - displaying maps in Joomla! CMS
rmk
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 26 Feb 2015, 13:41

Add a slash before the address link to the image

Post by rmk »

Hi,

add a slash before the address link to the image in the description of the marker. Image

The path on the site looks wrong Image

Simply link to another site is working properly. The problem is with a link to an image on another site. Slash (/) turns into a double link, which is still prescribed my site

version Joomla 3.3.6
jumla3x_guy
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 26 Feb 2015, 03:07

Re: Add a slash before the address link to the image

Post by jumla3x_guy »

Have you tried:

Code: Select all

<img src="images/logo-top.jpg" alt="" />
rmk
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 26 Feb 2015, 13:41

Re: Add a slash before the address link to the image

Post by rmk »

Picture is in another site.

Code: Select all

<img src="http://another-site/images/logo-top.jpg" alt="" />
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Add a slash before the address link to the image

Post by Jan »

Hi, try to see the database, the table Phoca Maps Markers - find the marker and see the description of it - which data you have here?

Are they with the slash or not?

Jan
If you find Phoca extensions useful, please support the project
rmk
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 26 Feb 2015, 13:41

Re: Add a slash before the address link to the image

Post by rmk »

Hi,

in database not slash. Slash only appears on the site after the publication and the only link to the image (in the control panel no slash)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Add a slash before the address link to the image

Post by Jan »

Hi, please test:

OPEN:

administrator\components\com_phocamaps\helpers\phocamaps.php

and change
FROM:

Code: Select all

public static function fixImagePath($description) {
		
		$description = str_replace('<img src="'.JURI::root(true).'/', '', $description);// no double
		$description = str_replace('<img src="', '<img src="'.JURI::root(true).'/', $description);
		return $description;
	}
TO:

Code: Select all

public static function fixImagePath($description) {
		
		$description = str_replace('<img src="'.JURI::root(true).'/', '', $description);// no double
		$description = str_replace('<img src="', '<img src="'.JURI::root(true).'/', $description);
		
		// correct possible problems with full paths
		$description = str_replace('<img src="'.JURI::root(true).'/http://', '<img src="http://', $description);
		$description = str_replace('<img src="/http://', '<img src="http://', $description);
		return $description;
	}
Now, the external image should be displayed for you.

Please let me know if this helped, so I can add it to next version.

Thank you, Jan
If you find Phoca extensions useful, please support the project
rmk
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 26 Feb 2015, 13:41

Re: Add a slash before the address link to the image

Post by rmk »

Hi,

These changes have helped me. Now all is well. Thank you very much.

P.S.
I regret that I did not see your reply earlier and has already managed to convert 7 sites (rewrote markers and added all the pictures in the root of the site)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Add a slash before the address link to the image

Post by Jan »

Ok, thank you for the information.

Jan
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Add a slash before the address link to the image

Post by Jan »

Hi, set in version 3.0.3

Jan
If you find Phoca extensions useful, please support the project
Post Reply