Closed smilearric closed 4 years ago
This looks like a config issue, please show your configuration for sonata_media
Thanks for narrowing down.
doctrine:
dbal:
types:
json: Sonata\Doctrine\Types\JsonType
orm:
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
SonataMediaBundle: ~
ApplicationSonataMediaBundle: ~
FOSUserBundle: ~
SonataUserBundle: ~
ApplicationSonataUserBundle: ~
AppBundle: ~
# https://sonata-project.org/bundles/media/3-x/doc/reference/installation.html#configuration
sonata_media:
# if you don't use default namespace configuration
#class:
# media: MyVendor\MediaBundle\Entity\Media
# gallery: MyVendor\MediaBundle\Entity\Gallery
# gallery_item: MyVendor\MediaBundle\Entity\GalleryItem
db_driver: doctrine_orm
default_context: default
contexts:
default:
download:
strategy: sonata.media.security.connected_strategy
mode: http
providers:
- sonata.media.provider.file
- sonata.media.provider.image
formats:
xs: { width: 100 , quality: 71}
sm: { width: 300 , quality: 61}
md: { width: 600 , quality: 71}
xl: { width: 1200 , quality: 61}
providers:
image:
resizer: sonata.media.resizer.square
cdn:
server:
path: /uploads/media
filesystem:
local:
directory: "%kernel.root_dir%/../web/uploads/media"
create: false
I've used EasyExtends and the FileSystem looks like this, if that could be a hint:
Did I miss a step such as:
At this point, the bundle is not yet ready. You need to generate the correct entities for the media:
bin/console sonata:easy-extends:generate --dest=src SonataMediaBundle --namespace_prefix=App
In this case, since this is not a Flex install, should I use the --namespace_prefix=App
option?
Regards
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Environment
Sonata packages
EDIT: Still happening with most recent version of SonataMediaBundle (other versions untouched, fixated in composer.json).
Symfony packages
PHP version
Subject
Edit View Screenshot
List View Screenshot
Problem
Exept for the Protected URL, other links (such as reference or default_SIZE) links & path to the media are relative to the Document Root and therefore broken when the site does not answer at the Document Root.
Steps to reproduce
A Sonata (Media Bundle) project into a sub-directory of your Webserver DocumentRoot. For some development environment reasons, you don't have a Virtual Host or a directive which would allow your site to answer at your DocRoot.
The site is running on a slug/slug subdirectory (cf. screenshots).
Ex.: http://localhost/ site_slug/another_slug /web/app_dev.php/
Expected results
As for any path in the page and for the Media reference Link, I'd expect the Media paths/links (edit view) or the preview image (list view) to be relative to the main controller's path, not to the Document Root.
Actual results
List view, Network file Response, Chrome developer tools
Edit view, after a click on the _defaultxs link, Chrome main rendering: