Comments (7)
I'm currently using Symfony 3.1 and I was facing the same issue.
I thought a function was already coded to retrieve this url but it seems not. I checked directly in the template using the dump()
function of twig.
There is only a function (bellow) allowing to redirect URLs of the type "/admin/manager/file/..."
to "/web/upload/.../"
. EDIT: this is not even the case, it only retrieves the file directly from the file path.
FileManagerBundle/Controller/ManagerController.php
Lines 287 to 301 in 4e35c8d
So, I added the following attribute in File.php
constructor:
$this->websiteUrl = str_replace('\\', '/', $this->getProtocol().$_SERVER['HTTP_HOST'].str_replace($_SERVER['DOCUMENT_ROOT'], '', $file));
And the following method:
/**
* Return the current protocol used by the website
* @return string return "http" or "https"
* Source: https://stackoverflow.com/a/14270161/8219923
*/
private function getProtocol(){
if (isset($_SERVER['HTTPS']) &&
($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$protocol = 'https://';
}
else {
$protocol = 'http://';
}
return $protocol;
}
I don't know if a Pull Request is useful. What do you think about that @artgris?
from filemanagerbundle.
Hi @Telous,
replace your dir path with a relative path:
artgris_file_manager:
# web_dir: web
conf:
default:
dir: "../web/img/uploads"
"../web" or "../public" are required to get 'public' image urls in filemanager.
from filemanagerbundle.
I upgraded my project to S4 to use the bundle, buts this look fine to use on S3
from filemanagerbundle.
I had some bugs during the installation but otherwise it works perfectly!
The badge on the README indicated this:
from filemanagerbundle.
Thx @baudev but binaryFileResponseAction is only used to obtain "private" images, when they are not in the web|public dir and not accessible by url.
if you remove".../web/", filemanage thinks it's a private directory
from filemanagerbundle.
Thanks @artgris, I will try it.
from filemanagerbundle.
Hi @Telous,
replace your dir path with a relative path:
artgris_file_manager: # web_dir: web conf: default: dir: "../web/img/uploads"
"../web" or "../public" are required to get 'public' image urls in filemanager.
I used this, but it generates an error: dir not found. Anyway, I updated the project to Symfony 4 and now it works fine. Thank you anyway
from filemanagerbundle.
Related Issues (20)
- Wrong file extension after downloading HOT 1
- How to chose file in tinyMCE? HOT 2
- Custom action in list or thumbnail views HOT 2
- Support for Symfony 6.1 HOT 1
- Question: How to preview text files ? HOT 2
- Remove the dependency on Sensio/framework-extra-bundle
- doctrine/annotations
- Prevent deletion of predefined folders HOT 2
- Notification position is wrong when used in iframe HOT 1
- Filename change after upload HOT 1
- Folder creation works but not file upload
- Symfony 6.3 HOT 3
- Position flash messages HOT 5
- Error 401 When Accessing Parent Folder with "+" in Name
- Change the translation HOT 10
- deprecated
- Exception thrown when using asset mapper HOT 1
- Symfony 7.1 DI deprecation
- Add "php bin/console assets:install" step to README installation instructions
- Problem with File Path Format in FileManagerBundle when Integrating with fos_ckeditor in easyadmin 3 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filemanagerbundle.