I'm trying to set up a Headless Wordpress project with Nuxt 3 and Apollo. For some reason, apollo's fetch is failing when trying to hit the Wordpress GraphQL endpoint. My file structure is as follows:
frontend
-.nuxt
-assets
-node_modules
-.gitignore
-.npmrc
-app.vue
-nuxt.config.ts
-package-lock.json
-package.json
-README.md
-tsconfig.json
wp-content
-plugins
-themes
-upgrade
-uploads
-index.php
docker-compose.yml
My docker-compose:
version: '3.1'
services:
wordpress:
image: wordpress:latest
ports:
- "80:80"
volumes:
- ./wp-content:/var/www/html/wp-content:delegated
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DEBUG: 1
depends_on:
- db
db:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
volumes:
- db-data:/var/lib/mysql:delegated
frontend:
container_name: frontend
command: -c "npm run dev"
image: node:latest
working_dir: /var/www/html/app
entrypoint: /bin/bash
ports:
- "3000:3000"
volumes:
- ./frontend:/var/www/html/app:delegated
tty: true
volumes:
db-data:
Nuxt config:
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
css: ['#/assets/styles/style.scss'],
modules: ['#nuxtjs/apollo'],
apollo: {
clients: {
default: {
httpEndpoint: 'http://localhost/graphql',
}
}
}
})
And finally, app.vue
<template>
<div class="app">
<p>{{ data?.posts }}</p>
</div>
</template>
<script setup>
const query = gql`
query NewQuery {
posts {
edges {
node {
title(format: RENDERED)
id
content
}
}
}
}
`
const { data, error} = await useAsyncQuery(query)
console.log(error)
</script>
The only error message I'm getting from apollo is "Fetch failed", no more info than that. I have WPGraphQL installed on the Wordpress instance and I can hit the graphql endpoint at localhost/graphql in the browser. I have an inkling that I'm messing up something with the networking or how the two ports are relating to one another, but I'm not sure. Any thoughts would be much appreciated. Thanks!
Related
I have two ansible tasks that download an archive (the latest wordpress version, for example) and extract that archive.
- name: Download WordPress
tags:
- wordpress
- wordpress:install
get_url: "url=http://wordpress.org/wordpress-{{ wordpress_version }}.tar.gz dest={{ www_docroot }}/wordpress-{{ wordpress_version }}.tar.gz"
- name: Extract archive
tags:
- wordpress
- wordpress:install
unarchive:
src: "{{ www_docroot }}/wordpress-{{ wordpress_version }}.tar.gz"
dest: "{{ www_docroot }}"
remote_src: True
I'm new to learning ansible and I'm trying to figure out: How can I make this idempotent so that it -
Does not download a file if file of the same name already exists or
Does not extract / expand the gzip archive if the specified target folder already exists
Thanks!
consider the force option for the first query( get_url ) .
consider the creates option for the second query( unarchive ) .
Sample code, you need something like this?
- name: Download WordPress
tags:
- wordpress
- wordpress:install
get_url:
url : "http://wordpress.org/wordpress-{{ wordpress_version }}.tar.gz dest={{ www_docroot }}/wordpress-{{ wordpress_version }}.tar.gz"
dest: "{{ wordpress_version }}/wordpress-{{ wordpress_version }}.tar.gz"
force : no
- name: Extract archive
tags:
- wordpress
- wordpress:install
unarchive:
src: "{{ www_docroot }}/wordpress-{{ wordpress_version }}.tar.gz"
dest: "{{ www_docroot }}"
creates : "{{ www_docroot }}/wordpress"
remote_src: True
get_url module already behaves in the way you want.
You might consider completely skipping the second step if nothing is downloaded on the first step. To achieve that you register return value of the first task and check if it is changed in the second with when. In your example it will be:
- name: Download WordPress
tags:
- wordpress
- wordpress:install
get_url: "url=http://wordpress.org/wordpress-{{ wordpress_version }}.tar.gz dest={{ www_docroot }}/wordpress-{{ wordpress_version }}.tar.gz"
register: download_wordpress
- name: Extract archive
tags:
- wordpress
- wordpress:install
unarchive:
src: "{{ www_docroot }}/wordpress-{{ wordpress_version }}.tar.gz"
dest: "{{ www_docroot }}"
remote_src: True
when: download_wordpress.changed
i got a problem with security and menu.
I have a menu point "Besuchsmanagement" set on_top: true
Now i have roles for this.
My problem is, that the on_top always be shown, if role is granted or not.
ROLES:
role_hierarchy:
ROLE_ADMIN_VISIT_READER:
- ROLE_ADMIN_VISIT_LIST
- ROLE_ADMIN_VISIT_VIEW
ROLE_ADMIN_VISIT_CREATOR:
- ROLE_ADMIN_VISIT_READER
- ROLE_ADMIN_VISIT_CREATE
- ROLE_ADMIN_VISIT_EDIT
ROLE_ADMIN_VISIT_ADMIN:
- ROLE_ADMIN_VISIT_ALL
ROLE_USER:
- ROLE_ADMIN_VISIT_ADMIN
services.yml
admin.visit:
class: ifabrik\VisitBundle\Admin\VisitAdmin
arguments: [~, ifabrik\VisitBundle\Entity\Visit, ~]
tags:
- { name: sonata.admin, group: Besuchsmanagement, manager_type: orm, on_top: true, icon: '<i class="fa fa-map-signs" aria-hidden="true"></i>' }
When i remove on_top - then roles are correct.
Instead of passing on_top in the service definition you should be configuring your admin menu in your app/config.yml.
Here is an example :
sonata_admin:
dashboard:
groups:
Customers Relationship Management:
label: libio.menu_label.crm
icon: '<i class="fa fa-address-card"></i>'
on_top: true
roles: [ROLE_SUPER_ADMIN]
items:
- route: admin_librinfo_crm_organism_list
label: libio.menu_label.organisms_list
As you can see you can specify the roles to wich the menu entry will be shown.
To find out the route execute the command
app/console (bin/console on sf3) debug:router
I have a problem with the imagine_filter that works in one page and not in the others even if I use it exactly the same way with the same photo.
In the first page, where my filter works, I have this src:
http://myserver.com/media/cache/shooting/photo_preview/75/55cb71cc8ba26-00001.jpg
However, on the page where the filter doesn't work, I have this src:
:///media/cache/shooting/photo_preview/75/55cb71cc8ba26-00001.jpg
Has anybody already have a problem like that?
Moreover, the first src only works on app.php and not on app_dev.php.
On my application, I'm using Gaufrette to upload photos to S3 and then Liip to apply the filters. The cache is on my server. This is my configuration:
"liip/imagine-bundle": "1.3.*#dev",
"knplabs/gaufrette": "0.1.*",
"knplabs/knp-gaufrette-bundle": "0.1.*#dev",
"aws/aws-sdk-php": "2.8.*#dev",
<--- The services --->
services:
mycompany.aws_s3.client:
class: Aws\S3\S3Client
factory_class: Aws\S3\S3Client
factory_method: 'factory'
arguments:
-
key: %amazon_aws_key%
secret: %amazon_aws_secret_key%
region: %amazon_aws_region%
mycompany.liip_imagine.binary.loader.stream.shooting:
class: '%liip_imagine.binary.loader.stream.class%'
arguments:
- 'gaufrette://shooting/'
tags:
- { name: 'liip_imagine.binary.loader', loader: 'stream.shooting' }
<--- Gaufrette --->
knp_gaufrette:
adapters:
shooting:
aws_s3:
service_id: mycompany.aws_s3.client
bucket_name: %amazon_s3_bucket%
options:
directory: shooting
filesystems:
shooting:
adapter: shooting
alias: shooting_filesystem
stream_wrapper: ~
<--- Liip --->
liip_imagine:
resolvers:
default:
web_path: ~
shooting:
web_path:
cache_prefix: /media/cache/shooting
controller:
filter_action: mycompany_imagine.controller:filterAction
filter_sets:
photo_preview:
data_loader: stream.shooting
cache: shooting
quality: 50
filters:
upscale: { min: [690, 690] }
thumbnail: { size: [690, 690], mode: outbound}
<--- Twig --->
<img src="{{ photo.imagepath | imagine_filter('photo_preview') }}" alt="">
I got an answer on Github. I just needed to change my resolver:
https://github.com/liip/LiipImagineBundle/issues/203
I can't figured out why I have this error.
Herewith more informations abour my problem :
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "sonata_customer_addresses" as such route does not exist.") in SonataUserBundle:Profile:action.html.twig at line 27.
to implement my own User Class.
I use Symfony 2.4 with dev-master SonataAdminBundle and SonataUserBundle. I try
you can find my config.yml :
sonata_user:
security_acl: true
manager_type: orm
profile:
# Profile show page is a dashboard as in SonataAdminBundle
dashboard:
blocks:
- { position: left, type: sonata.block.service.text, settings: { content: "<h2>Welcome!</h2> This is a sample user profile dashboard, feel free to override it in the configuration! Want to make this text dynamic? For instance display the user's name? Create a dedicated block and edit the configuration!"} }
- { position: left, type: sonata.order.block.recent_orders, settings: { title: Recent Orders, number: 5, mode: public }}
- { position: right, type: sonata.timeline.block.timeline, settings: { max_per_page: 15 }}
- { position: right, type: sonata.news.block.recent_posts, settings: { title: Recent Posts, number: 5, mode: public }}
- { position: right, type: sonata.news.block.recent_comments, settings: { title: Recent Comments, number: 5, mode: public }}
# Customize user portal menu by setting links
menu:
- { route: 'sonata_user_profile_show', label: 'sonata_profile_title', domain: 'SonataUserBundle'}
- { route: 'sonata_user_profile_edit', label: 'link_edit_profile', domain: 'SonataUserBundle'}
- { route: 'sonata_customer_addresses', label: 'link_list_addresses', domain: 'SonataCustomerBundle'}
- { route: 'sonata_user_profile_edit_authentication', label: 'link_edit_authentication', domain: 'SonataUserBundle'}
- { route: 'sonata_order_index', label: 'order_list', domain: 'SonataOrderBundle'}
#sonata_admin:
# templates:
# dashboard: SonataAdminBundle:Core:dashboard.html.twig
sonata_admin:
title: Admin Panel
title_logo: /bundles/sonataadmin/logo_title.png
templates:
# default global templates
layout: SonataAdminBundle::standard_layout.html.twig
ajax: SonataAdminBundle::ajax_layout.html.twig
# default actions templates, should extend a global templates
list: SonataAdminBundle:CRUD:list.html.twig
show: SonataAdminBundle:CRUD:show.html.twig
edit: SonataAdminBundle:CRUD:edit.html.twig
dashboard:
blocks:
# display a dashboard block
- { position: left, type: sonata.admin.block.admin_list }
sonata_block:
default_contexts: [cms]
blocks:
sonata.admin.block.admin_list:
contexts: [admin]
#sonata.admin_doctrine_orm.block.audit:
# contexts: [admin]
sonata.user.block.menu:
sonata.user.block.account:
sonata.block.service.text:
sonata.block.service.action:
sonata.block.service.rss:
sonata_doctrine_orm_admin:
# default value is null, so doctrine uses the value defined in the configuration
entity_manager: ~
templates:
form:
- SonataDoctrineORMAdminBundle:Form:form_admin_fields.html.twig
filter:
- SonataDoctrineORMAdminBundle:Form:filter_admin_fields.html.twig
types:
list:
array: SonataAdminBundle:CRUD:list_array.html.twig
boolean: SonataAdminBundle:CRUD:list_boolean.html.twig
date: SonataAdminBundle:CRUD:list_date.html.twig
time: SonataAdminBundle:CRUD:list_time.html.twig
datetime: SonataAdminBundle:CRUD:list_datetime.html.twig
text: SonataAdminBundle:CRUD:base_list_field.html.twig
trans: SonataAdminBundle:CRUD:list_trans.html.twig
string: SonataAdminBundle:CRUD:base_list_field.html.twig
smallint: SonataAdminBundle:CRUD:base_list_field.html.twig
bigint: SonataAdminBundle:CRUD:base_list_field.html.twig
integer: SonataAdminBundle:CRUD:base_list_field.html.twig
decimal: SonataAdminBundle:CRUD:base_list_field.html.twig
identifier: SonataAdminBundle:CRUD:base_list_field.html.twig
show:
array: SonataAdminBundle:CRUD:show_array.html.twig
boolean: SonataAdminBundle:CRUD:show_boolean.html.twig
date: SonataAdminBundle:CRUD:show_date.html.twig
time: SonataAdminBundle:CRUD:show_time.html.twig
datetime: SonataAdminBundle:CRUD:show_datetime.html.twig
text: SonataAdminBundle:CRUD:base_show_field.html.twig
trans: SonataAdminBundle:CRUD:show_trans.html.twig
string: SonataAdminBundle:CRUD:base_show_field.html.twig
smallint: SonataAdminBundle:CRUD:base_show_field.html.twig
bigint: SonataAdminBundle:CRUD:base_show_field.html.twig
integer: SonataAdminBundle:CRUD:base_show_field.html.twig
decimal: SonataAdminBundle:CRUD:base_show_field.html.twig
# Doctrine Configuration
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
types:
json: Sonata\Doctrine\Types\JsonType
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
fos_user:
db_driver: orm
firewall_name: main
user_class: MyProject\UserBundle\Entity\User
group:
group_class: MyProject\UserBundle\Entity\Group
group_manager: sonata.user.orm.group_manager
service:
user_manager: sonata.user.orm.user_manager
and my routing.yml here :
sonata_user_security:
resource: "#SonataUserBundle/Resources/config/routing/sonata_security_1.xml"
sonata_user_resetting:
resource: "#SonataUserBundle/Resources/config/routing/sonata_resetting_1.xml"
prefix: /resetting
sonata_user_profile:
resource: "#SonataUserBundle/Resources/config/routing/sonata_profile_1.xml"
prefix: /profile
sonata_user_register:
resource: "#SonataUserBundle/Resources/config/routing/sonata_registration_1.xml"
prefix: /register
sonata_user_change_password:
resource: "#SonataUserBundle/Resources/config/routing/sonata_change_password_1.xml"
prefix: /profile
sonata_user:
resource: '#SonataUserBundle/Resources/config/routing/admin_security.xml'
prefix: /admin
admin:
resource: '#SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin
EDIT 1:
[router] Current routes
Name Method Scheme Host Path
_assetic_bootstrap_css ANY ANY ANY /assetic/bootstrap_css.less
_assetic_bootstrap_css_0 ANY ANY ANY /assetic/bootstrap_css_bootstrap_1.less
_assetic_jquery ANY ANY ANY /js/jquery.js
_assetic_jquery_0 ANY ANY ANY /js/jquery_jquery-2.1.1_1.js
_assetic_bootstrap_js ANY ANY ANY /js/bootstrap.js
_assetic_bootstrap_js_0 ANY ANY ANY /js/bootstrap_transition_1.js
_assetic_bootstrap_js_1 ANY ANY ANY /js/bootstrap_alert_2.js
_assetic_bootstrap_js_2 ANY ANY ANY /js/bootstrap_button_3.js
_assetic_bootstrap_js_3 ANY ANY ANY /js/bootstrap_carousel_4.js
_assetic_bootstrap_js_4 ANY ANY ANY /js/bootstrap_collapse_5.js
_assetic_bootstrap_js_5 ANY ANY ANY /js/bootstrap_dropdown_6.js
_assetic_bootstrap_js_6 ANY ANY ANY /js/bootstrap_modal_7.js
_assetic_bootstrap_js_7 ANY ANY ANY /js/bootstrap_tooltip_8.js
_assetic_bootstrap_js_8 ANY ANY ANY /js/bootstrap_popover_9.js
_assetic_bootstrap_js_9 ANY ANY ANY /js/bootstrap_scrollspy_10.js
_assetic_bootstrap_js_10 ANY ANY ANY /js/bootstrap_tab_11.js
_assetic_bootstrap_js_11 ANY ANY ANY /js/bootstrap_affix_12.js
_assetic_a56fa94 ANY ANY ANY /js/a56fa94.js
_assetic_a56fa94_0 ANY ANY ANY /js/a56fa94_part_1.js
_assetic_a56fa94_1 ANY ANY ANY /js/a56fa94_part_2.js
_assetic_65cec74 ANY ANY ANY /css/65cec74.css
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_purge ANY ANY ANY /_profiler/purge
_profiler_info ANY ANY ANY /_profiler/info/{about}
_profiler_import ANY ANY ANY /_profiler/import
_profiler_export ANY ANY ANY /_profiler/export/{token}.txt
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
_configurator_home ANY ANY ANY /_configurator/
_configurator_step ANY ANY ANY /_configurator/step/{index}
_configurator_final ANY ANY ANY /_configurator/final
fos_user_security_login ANY ANY ANY /login
fos_user_security_check POST ANY ANY /login_check
fos_user_security_logout ANY ANY ANY /logout
sonata_user_security_login ANY ANY ANY /login
sonata_user_security_check POST ANY ANY /login_check
sonata_user_security_logout ANY ANY ANY /logout
fos_user_resetting_request GET ANY ANY /resetting/request
fos_user_resetting_send_email POST ANY ANY /resetting/send-email
fos_user_resetting_check_email GET ANY ANY /resetting/check-email
fos_user_resetting_reset GET|POST ANY ANY /resetting/reset/{token}
sonata_user_resetting_request GET ANY ANY /resetting/request
sonata_user_resetting_send_email POST ANY ANY /resetting/send-email
sonata_user_resetting_check_email GET ANY ANY /resetting/check-email
sonata_user_resetting_reset GET|POST ANY ANY /resetting/reset/{token}
fos_user_profile_show GET ANY ANY /profile/
fos_user_profile_edit_authentication ANY ANY ANY /profile/edit-authentication
fos_user_profile_edit ANY ANY ANY /profile/edit-profile
sonata_user_profile_show GET ANY ANY /profile/
sonata_user_profile_edit_authentication ANY ANY ANY /profile/edit-authentication
sonata_user_profile_edit ANY ANY ANY /profile/edit-profile
fos_user_registration_register ANY ANY ANY /register/
fos_user_registration_check_email GET ANY ANY /register/check-email
fos_user_registration_confirm GET ANY ANY /register/confirm/{token}
fos_user_registration_confirmed GET ANY ANY /register/confirmed
sonata_user_registration_register ANY ANY ANY /register/
sonata_user_registration_check_email GET ANY ANY /register/check-email
sonata_user_registration_confirm GET ANY ANY /register/confirm/{token}
sonata_user_registration_confirmed GET ANY ANY /register/confirmed
fos_user_change_password GET|POST ANY ANY /profile/change-password
sonata_user_change_password GET|POST ANY ANY /profile/change-password
sonata_user_admin_security_login ANY ANY ANY /admin/login
sonata_user_admin_security_check ANY ANY ANY /admin/login_check
sonata_user_admin_security_logout ANY ANY ANY /admin/logout
sonata_admin_redirect ANY ANY ANY /admin/
sonata_admin_dashboard ANY ANY ANY /admin/dashboard
sonata_admin_retrieve_form_element ANY ANY ANY /admin/core/get-form-field-element
sonata_admin_append_form_element ANY ANY ANY /admin/core/append-form-field-element
sonata_admin_short_object_information ANY ANY ANY /admin/core/get-short-object-description.{_format}
sonata_admin_set_object_field_value ANY ANY ANY /admin/core/set-object-field-value
sonata_admin_search ANY ANY ANY /admin/search
sonata_admin_retrieve_autocomplete_items ANY ANY ANY /admin/core/get-autocomplete-items
admin_sonata_user_user_list ANY ANY ANY /admin/sonata/user/user/list
admin_sonata_user_user_create ANY ANY ANY /admin/sonata/user/user/create
admin_sonata_user_user_batch ANY ANY ANY /admin/sonata/user/user/batch
admin_sonata_user_user_edit ANY ANY ANY /admin/sonata/user/user/{id}/edit
admin_sonata_user_user_delete ANY ANY ANY /admin/sonata/user/user/{id}/delete
admin_sonata_user_user_show ANY ANY ANY /admin/sonata/user/user/{id}/show
admin_sonata_user_user_export ANY ANY ANY /admin/sonata/user/user/export
admin_sonata_user_group_list ANY ANY ANY /admin/sonata/user/group/list
admin_sonata_user_group_create ANY ANY ANY /admin/sonata/user/group/create
admin_sonata_user_group_batch ANY ANY ANY /admin/sonata/user/group/batch
admin_sonata_user_group_edit ANY ANY ANY /admin/sonata/user/group/{id}/edit
admin_sonata_user_group_delete ANY ANY ANY /admin/sonata/user/group/{id}/delete
admin_sonata_user_group_show ANY ANY ANY /admin/sonata/user/group/{id}/show
admin_sonata_user_group_export ANY ANY ANY /admin/sonata/user/group/export
myproject_user_default_index ANY ANY ANY /hello/{name}
myproject_comment_default_index ANY ANY ANY /hello/{name}
myproject_provider_default_index ANY ANY ANY /hello/{name}
myproject_provider_providersearch_index ANY ANY ANY /ProviderSearch
myproject_service_default_index ANY ANY ANY /hello/{name}
myproject_geo_default_index ANY ANY ANY /hello/{name}
myproject_schedule_default_index ANY ANY ANY /hello/{name}
myproject_coupon_couponsearch_index ANY ANY ANY /couponSearch
my_filter ANY ANY ANY /filter/
myproject_coupon_default_index ANY ANY ANY /coupon
myproject_association_search ANY ANY ANY /associationSearch
myproject_association_search_result ANY ANY ANY /associationSearch/result
myproject_association_search_show ANY ANY ANY /association/{slug}
myproject_contact ANY ANY ANY /contact
myproject_core_homepage ANY ANY ANY /
myproject_city_typeahead ANY ANY ANY /autocompleteCity
myproject_assoName_typeahead ANY ANY ANY /autocompleteAssoName
myproject_providerName_typeahead ANY ANY ANY /autocompleteProviderName
myproject_core_static ANY ANY ANY /{page}
myproject_coupon ANY ANY ANY /coupon
myproject_coupon_search ANY ANY ANY /couponSearch
myproject_coupon_search_result ANY ANY ANY /couponSearch/result
myproject_provider_search_show ANY ANY ANY /provider/{slug}
fos_js_routing_js ANY ANY ANY /js/routing.{_format}
Ok I finally got a dashboard by removing all in sonata_user like this :
sonata_user:
security_acl: true
manager_type: orm
I try to get a Dashboard like in this documentation : http://sonata-project.org/bundles/user/2-2/doc/reference/user_dashboard.html without success.
I have a blank page now, I will do all dashboard on my own,I can't see other way...
You should copy paste the code from the inatallation documentation into config.yml (like me).
Remove the lines with sonata_customer and sonata_order.
profile:
# Profile show page is a dashboard as in SonataAdminBundle
dashboard:
blocks:
- { position: left, type: sonata.block.service.text, settings: { content: "<h2>Welcome!</h2> This is a sample user profile dashboard, feel free to override it in the configuration! Want to make this text dynamic? For instance display the user's name? Create a dedicated block and edit the configuration!"} }
- { position: left, type: sonata.order.block.recent_orders, settings: { title: Recent Orders, number: 5, mode: public }}
- { position: right, type: sonata.timeline.block.timeline, settings: { max_per_page: 15 }}
- { position: right, type: sonata.news.block.recent_posts, settings: { title: Recent Posts, number: 5, mode: public }}
- { position: right, type: sonata.news.block.recent_comments, settings: { title: Recent Comments, number: 5, mode: public }}
# Customize user portal menu by setting links
menu:
- { route: 'sonata_user_profile_show', label: 'sonata_profile_title', domain: 'SonataUserBundle'}
- { route: 'sonata_user_profile_edit', label: 'link_edit_profile', domain: 'SonataUserBundle'}
- { route: 'sonata_customer_addresses', label: 'link_list_addresses', domain: 'SonataCustomerBundle'}
- { route: 'sonata_user_profile_edit_authentication', label: 'link_edit_authentication', domain: 'SonataUserBundle'}
- { route: 'sonata_order_index', label: 'order_list', domain: 'SonataOrderBundle'}
I am just trying to get working LiipImagineBundle.
Ok, all I got so far:
Installed using composer
$ php composer.phar require "liip/imagine-bundle:dev-master"
Enabled bundle in AppKernel.php
new Liip\ImagineBundle\LiipImagineBundle(),
Added to routing.yml
_imagine path
Added liip_imagine filter in config.yml
Checked using php app/console router:debug and path _imagine_my_thumb exist.
But after using:
<img src="{{ '/relative/path/to/image.jpg' | imagine_filter('my_thumb') }}" />
image is not rendered, path is simply not found error.
prod.log says that Route _imagine_my_thumb does not exist, although it exist, because it's displayed using router:debug for both environments.
You know that you should replace '/relative/path/to/image.jpg' with your image path?
Make sure your file exists.
A working example
config:
liip_imagine:
driver: gd
web_root: %kernel.root_dir%/../web
data_root: %kernel.root_dir%/../app
cache_mkdir_mode: 0777
cache_prefix: /media/cache
cache: web_path
cache_clearer: true
data_loader: filesystem
controller_action: liip_imagine.controller:filterAction
formats: []
filter_sets:
avatar:
filters:
thumbnail: { size: [40, 40], mode: outbound }
profile:
filters:
relative_resize: { widen: 500 }
html:
<img src="{{ 'uploads/images/filename.jpg' | imagine_filter('avatar') }}" alt="image">
enter code here
routing.yml:
_imagine:
resource: .
type: imagine
Remark: My source folder is in the app folder (see: data_root)
I had similar problem and after enable of php_fileinfo extension in php.ini render start to work.