Hi
after that i upload an image in the editor i wuould like to have the prefix path ( or the hostname) different from the
local server.
This is useful when u want for example use a http://image.example.com/ server
aslo if u edit on http://editor.example.com/
so for example th image that could be loaded in
http://editor.example.com/myimage.gif
should be render in html code as
http://image.example.com/myimage.gif
How can i change then this hostname ( or site prefix) into config or into php script?
Seems i can play only with directory prefix but not with hostname.
Tue, 10/28/2008 - 13:08
#1
Re: upload file on a different virtual host
Hi, I had the same problem when saving/loading the text form from/to a db.
I solved it by using two functions to convert the images root address.
I hope this will be useful for your job (I work with asp version)
'converts the text before save it into the db -----------------------------------------------
function urltodb (url)
HttpBase = "src=" & Chr(34) & "http://www.yourdomain.com/" 'put here your external root address
url= url & ""
trovahttp = inStr (url, "src=")
trovamailer = inStr (url,thispath) +1
if trovahttp = 0 or trovamailer = 0 then
urltodb=url
exit function
end if
baseurl = mid (url, trovahttp, trovamailer - trovahttp)
urltodb = Replace (url,baseurl,HttpBase)
end function
'--------------------------------------------------------------------------------------------
'converts the text loaded from the db before to display it on the editor ------------------
function urlfromdb (url)
thispath = "/fckeditor/" ' the path where fckeditor is installed on your local machine
url=url & ""
path_info = Request.ServerVariables ("PATH_INFO")
newbaseurl = Left (path_info, 8)
newbaseurl = Left (path_info, inStr (path_info, thispath))
newbaseurl = "src=" & chr(34) & "http://" & Request.ServerVariables ("HTTP_HOST") & newbaseurl
trovahttp = inStr (url, "src=" & chr(34) & "http:")
trovamailer = inStr (url,thispath) +1
if trovahttp = 0 or trovamailer = 0 then
urlfromdb=url
exit function
end if
baseurl = mid (url, trovahttp, trovamailer - trovahttp)
urlfromdb = Replace (url,baseurl,newbaseurl)
end function
'---------------------------------------------------------------------------------------------