CodeIgniter Forums
Remove base_url() from whole URL - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Remove base_url() from whole URL (/showthread.php?tid=41525)



Remove base_url() from whole URL - El Forum - 05-10-2011

[eluser]Zimooon[/eluser]
Hey guys,

I have an onclick copy ( i display images and user can click on them and the URL of the image written into a textfield) .
The problem is : i just want siteurl not the full url.
f.e.:
image url: www.example.com/images/asd.jpg
this url get copied into my textfield and saved like this into my DB.
Now i want only this part: /images/asd.jpg get saved to my DB.
Is there any way to substract the base_url() from the full url?

this is my js function:

[removed]
function clicked(address) {
document.getElementById('copy_img').value = address.src;
}[removed]

and i call it via:

onclick="clicked(this)"


best regards


Remove base_url() from whole URL - El Forum - 05-10-2011

[eluser]Zimooon[/eluser]
Oh was easy just thought about too hard ways:

for everyone :

$image = uri_string($this->input->post('image'));

Uri_string. CI ftw , userguide ftw Smile
first read than post .