I've installed LiipImagineBundle to Symfony 2 using this method - Installing and running LiipImagineBundle in symfony 2.1
I've done everything it asks and it initially creates the thumbnail image, however if I change the image dimensions in config.yml the image doesn't change!
I've tried clearing the cache using app/console cache:clear but I get the following error:
[Symfony\Component\Filesystem\Exception\IOException]
Failed to remove file /localhost/path/web//media/cache/my_thumb/media/test.jpg
Here is what my twig template looks like:
<img src="{{ asset(entity.filename) | imagine_filter('my_thumb') }}" />
It looks as though it can't remove the image in order to generate the new one, any ideas?
UPDATE:
Here is my routing file:
# app/config/routing.yml
_imagine:
resource: .
type: imagine
Here is my config file:
# app/config/config.yml
liip_imagine:
filter_sets:
my_thumb:
quality: 75
filters:
thumbnail: { size: [120, 90], mode: outbound }
Try to apply the same permissions to your image directory as you did with the app/logs and app/cache folders.
You should then be able to clear the cache without any errors.
I haven't used the LiipImagineBundle yet, but i think it's best to clear the cache after each change to the dimensions, otherwise the bundle would have to check if the image was changed on each request (which defeats the purpose of caching)!
Hope this helps.
Related
So I have images working on my dev environment, however when i try to see them on the production server I receive a 404 error, the images are located in storage/app/public folder, I have ran the following command:
php artisan storage:link
The output says it works however it is still a 404 error when navigating to /storage/imagefolder/image on the site
Technically images are accessible through the public folder, not the storage folder.
In your Code you can access them like:
<img src="{{ asset('imagefolder/image') }}" />
You can find the correct/final image url with:
dd(asset('imagefolder/image'));
First delete the old symlink
Then from the command:
php artisan storage: link
And to display files:
<img src="{{ asset('imagefolder/fileName') }}" />
or
<img src="{{ /storage/imagefolder/fileName }}" />
File permission error on the existing link to storage from the public folder, deleting the link and re running the command fixed the issue.
So,i've been having problems with integrating file manager to TinyMCE 5,uploading images into a specified folder using the file manager works without any issues,that is also true for deleting the images,but the problem is when you try to use the images,they appear as blank and if you open a console you will see error 404 messages that images don't exist
The solution that worked for me is that i went to .env file which is inside of your laravel project and then changed this line of code which is usually located in the first few lines of the file:
APP_URL=http://localhost
to this
APP_URL=http://127.0.0.1:8000
It seems like file manager uses APP_URL to build the URL for some reason,still haven't found out why tho
so I seem to be a bit confused on how to work with images in webpack encore + assets.
I store all JS & CSS like this
/assets/js
/assets/css
...
With encore I can access them later from my /public/build folder - no issues there.
Now I want to store some images (e.g. file upload).
First idea was to store them inside a folder like /assets/images. But with the current settings & using assets I can only access files inside /public/build folder.
So I tried to use to copyFiles to copy everything from /assets/images to /public/build/images.
But this does not automatically copy my files (e.g. file upload to /assets/images/ does not copy it to /public/build - which is in order not accessible in my project). So I would need to run manually encore - which I don't want.
Second idea was to store the uploaded images directly inside /public/build/images but those files would be deleted when I run encore.
Next I disabled the webpack option cleanupOutputBeforeBuild, so images would not be deleted. But without this option the folder will be flooded by new JS & CSS Files everytime I run encore.
What do I need?
A solution to store my images either way in /assets folder & make them available for my project.
or
store the images directly in /public/build folder without encore deleting them nor flooding the folder with JS/CSS by disabling cleanupOutput Option.
Thanks in advance ~Syllz
If u need to use it in JS, just require the file:
// assets/app.js
import logoPath from '../images/logo.png';
let html = `<img src="${logoPath}" alt="ACME logo">`;
When you require an image file, Webpack copies it into your output directory and returns the final, public path to that file.
If u need using it from a templates:
You need to install file-loader to use copyFiles()
yarn add file-loader#^6.0.0 --dev
then enable it in webpack.config.js:
.copyFiles({
from: './assets/images',
//optional target path, relative to the output dir
//to: 'images/[path][name].[ext]',
//if versioning is enabled, add the file hash too
to: 'images/[path][name].[hash:8].[ext]',
//only copy files matching this pattern
//pattern: /\.(png|jpg|jpeg)$/
})
then use it in your twig template:
<img src="{{ asset('build/images/logo.png') }}" alt="ACME logo">
more details in Symfony documentation
You can use the CopyWebpackPlugin to do this. You can read this post for more details.
Solution to my problem:
Store the images into /public/images and not into the build folder - which will be deleted when running encore.
I am update composer and use barryvdh/laravel-dompdf package.
the problem is when i click the button it show me error like image below:-
Is that anyway to change the folder path? or am I missing code to modify path to download the pdf file?
You need to run this command:
php artisan vendor:publish
Then, try to create a fonts directory in the storage directory.
i.e. storage/app/fonts. Also, remember to make it writable.
For maximum execution time of 30 seconds exceeded, this is not laravel related issue but it's about php configuration issue. Please see this and fix it: http://php.net/manual/en/info.configuration.php#ini.max-execution-time
You can also see this answer: https://stackoverflow.com/a/30290770/6000629
Hope this will helps you!
Try this:
$pdf = PDF::loadView('pdf/personalpdf', compact('user','result'))->setOptions(['defaultFont' => 'sans-serif']);
It worked for me, I didn't make any file/folder
Just remove the reference to css external file in your cart.placeOrder.blade
Note: This directory must exist and be writable by the webserver process.
under the config file thats what it say: therefore you should create the fonts directory inside the storage.
"font_cache" => storage_path('fonts/'),
I have a rails 4 app that use CKeditor. In dev mode it works fine but in production ckeditor does not apear and there is a blank space at the location of the textarea.
According to the logs, the following file is missing :
ActionController::RoutingError (No route matches [GET] "/assets/ckeditor/styles.js")
And if i precompile the asset i can see the following file generated :
public/assets/ckeditor/styles-65fee53acf063b3d207bc00b4f7ce0d5.js
Here is the ckeditor line of my application.rb :
config.assets.precompile += Ckeditor.assets
It seems that's the file CKeditor want but it is not looking for the precompiled one. How can i fix that?
i have pre-compiled my assets and pushed my repo to production server and got similar bug. And ckeditor was not loading.
Following worked for me:
1) Under config > environment > productio.rb file there is a line
config.assets.compile = false
i changed false to true and pushed the code to production site. Stopped and started unicorn. That did the trick now ckeditor is loading.
hope that helps.
For Rails 5 you have use in Gemfile
gem 'ckeditor', github: 'galetahub/ckeditor'
look here:
https://github.com/galetahub/ckeditor/issues/719
Did you follow these steps in the Readme? https://github.com/galetahub/ckeditor#usage-with-rails-4-assets
Specifying the CKEditor BasePath in the <head> section of my application.html.erb file fixed my issue
<script type="text/javascript">
var CKEDITOR_BASEPATH = '/assets/ckeditor/';
</script>
I had the same problem, i had included config.assets.compile = true and didn´t work...
Finally i did rake
rake assets:precompile
from the console.
If you are uploading images directly to AWS S3 you need to comment out the carrierwave or paperclip initializer while precompiling.
Then pushed it to production and worked fine!