Hi, i try to install Cockpit on Windows Wamp and i’ve a problem with image upload.
The problem is in the url:
http://localhost:8080/cp/cockpit/utils/thumb_url?src=http://localhost:8080/C:/wamp64/www\logo_gaia_email.png&w=undefined&h=160&m=bestFit&re=1
The correct url for generate the thumb does not include localhost.
Where is the setting for remove localhost:8080/ ?
Thank’s a lot
I’m afraid you can’t set this directly in Cockpit. However, you can achieve this really easyly with JS.
function removeHost(url) {
let urlObj = new URL(url);
return urlObj.pathname;
}
let address = removeHost('http://localhost:8080/cp/cockpit/utils/thumb_url?src=http://localhost:8080/C:/wamp64/www\logo_gaia_email.png&w=undefined&h=160&m=bestFit&re=1');
address
will than be /cp/cockpit/utils/thumb_url
If you need to keep the URL parameters in your url, use this function instead:
function removeHost(url) {
let urlObj = new URL(url);
let res = urlObj.href.replace(urlObj.origin, '');
return res;
}
let address = removeHost('http://localhost:8080/cp/cockpit/utils/thumb_url?src=http://localhost:8080/C:/wamp64/www\logo_gaia_email.png&w=undefined&h=160&m=bestFit&re=1');
In that case, address
will be /cp/cockpit/utils/thumb_url?src=http://localhost:8080/C:/wamp64/wwwlogo_gaia_email.png&w=undefined&h=160&m=bestFit&re=1
Cheers.