I have this path

```
http://localhost/wordpress/wp-content/uploads/2015/10/imagen.jpg

```

I want to convert that path 
something as it

```
../../../imagen.jpg

```

( or using `~` or `./` or other way assuming you don't know the folders)

I am working with Wordpress.