Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By ZambalaRed on
I believe it has happened after recently my webhost did some maintenance ; but also - I was lazy with updating last 2 weeks; but earlier it was working.....
so - when I upload an image in Article Edit - no images appears. and probably they are not produced, I couldn't find in file folder....
I had all image styles set like Large, medium, small, this and that....nothing....
what should I check now? (and hosting is shared)
Comments
Check: admin/reports/status
Check: admin/reports/status
It's probably just file permissions in your public files directory. The webserver must be able to write into all the folders inside that directory.
I like cookies!
Hi ZambalaRed ,
Hi ZambalaRed ,
If you Give 777 permissions to sites/all/default/files folder then it works fine.. and also check whether your style is created or not in this path sites/all/default/files/styles
I hope this will work perfectly.
Thanks.
Raj Laddha
cmsMinds
rajesh@cmsminds.com
Drupal Development - North Carolina
If you Give 777 permissions
Sorry, but this is a very naive approach of setting file permissions and I have seen it far too often to let it pass uncommented. Especially the last '7' almost never makes sense in any scenario whatsoever. Here is a guide to setup proper file permissions / ownership for a webserver running Drupal.
Just as an example. All of our websites, which had setup proper file permissions during the Drupageddon last year were basically immune against code changes and therefore there was no danger of the whole server being compromised, whilst all the websites with "lazy" file permissions gave us quite some headaches. :-)
I like cookies!
Indeed, it is not so ease;
Indeed, it is not so easy;
I am still reading this, but I believe they have something server side about security....
So, a few days back hosting support where trying to play around with this for a good while and told me they have made some fix; later on they said - sorry, we just added fix for PNG and now we added fix for JPG too....
- and I checked, it was working at the moment;
- now, after a few days I am updating again, and it doesn't work again....and now waiting for support...
But earlier it was working all the same for 1 whole year....but they did some server maintenance and not anymore...
See is GD library is
See is GD library is installed or not here Check: admin/reports/status, if not install GD library on server.
On my new server I needed to
On my new server I needed to add 775 to my redefined tmp directory ($conf['file_temporary_path'] = '/home/mysuer/tmp';), seems PHP could not write to this directory.
So, just check the tmp directory access rights too.
--
Denes Szabo - http://internode.hu
Image Styles not applied
I am having the same error on a Drupal 8.0.1 site. Image styles are not applied to a node or in a view. However, I see them applied to during view preview.
Any idea how to solve this?
Image Style not created on drupal 8.1.1
I check permission and permission of folder is 775 and it is Ok. but image styles in views preview not generated, I look at the path, the file not generated also when I check Drupal recent log just see image not found.
I have be born to be mankind
I have the same error on a
I have the same error on a Drupal 8.1.7 site... On my local website, I haven't the problem, it's just online.
I've check any permissions.
Someone found a solution ?
Thank for help
Drupal Image styles issue 8.2.x
Hi Drupalers,
Posting on this forum with hope someone can provide insight about the Drupal thumbnail creation i.e. image styles. I am using views to display image thumbnails on the pages. The directory permission i.e. for /sites/default/files/ is writable and have even tried 777 but thumbnails are not created for few new records generally. the behavior is inconsistent and not acceptable on site.
Its very strange issue and need to know how it all works. The image thumbnails using styles do appear but not as soon as images are uploaded. Image style thumbnails start appearing after some time which can be few days as well.
Questions:-
1. When are style related thumbnails supposed to created? When page is accessed or images are uploaded in the content ?
2. In case of Views how does this happen ?
3. What can be possible reasons for this issue ?
Few of the reason I can think are:-
file settings
I have gone through a lot of documentation and nothing seems to help. Its better to understand the functioning of this.
Thanks very much for any help
=-=
as the thread is old and in reference to D7, I suggest a new thread.
IIRC image styles are generated on request. Though I don't know if this changed in D8. Drush has a generate command that may be worth looking at.
also of note: Rules Image Styles & Image Style Pregenerate modules may aid.
Image token setting
I had suppressed image token appending to image URL by adding a line of code to settings.php. It did suppress the token but thumbnails also stopped generating. So I had to revert back and again not all images are being created.
Anyway thanks for your comment but both the modules you mentioned are not ported to D8.
=-=
The modules I mentioned align with the version of the thread (may not aid you but may aid others like you that find this thread for D7). For D8, try drush generate as mentioned.
image styles working but not showing up
Hi VM,
I worked more on this and now image styles are being generated. The source code of images is like /path-to-image/img.jpg?itok=cJsLb4Qr but problem is that not all images appear on first load of page. I have to ctrl +f5 many times to get the images on page. This can not be acceptable from end users perspective.
How do you suggest to deal with this ?
Thank a lot for your support. I really appreciate it.
similar problem, please help!
I finally got working preview in styles setting. In folder is now created styles subfolder, with test thumbnail.
But when working with files, it doesnt work.
I have files on private, next to www, so ../something is set as path.
Files are visible in content if format is original.
but whenb choose thumbnail, doesnt work.
can you help me?
i think I have correct rights and www-data everywhere.
thank you!!
"."
Your file permissions in your sites/default/files directory should be set to 775. If so and your site is still not generation image styles, try delete the .htaccess in sites/default/files. Refresh your site so Drupal rebuilds it. Hopefully that will help...
thanks.
thanks.
I have reviewed rights and owners of whole structure, and it works now.
strange that for drupal7, different setting was working....anyway, its ok now
Solution for Drupal 8 that worked for me
I can echo that this worked
I can echo that this worked for me as well...
This feels really broken though. This seems to be overriding the security handlers that Drupal has in place for this directory.
For my issue specifically
For my issue specifically that was resolved with this htaccess hack, the actual problem ended up being that mod_rewrite was not enabled for the Apache build hosting the code. Because mod_rewrite wasn't enabled, Drupal couldn't redirect to the appropriate call to generate the image.
This way working. Thanks
This way working. Thanks
For me too, Drupal 7
For me too, Drupal 7
Unfortunately it hasn't
Unfortunately it hasn't worked for me...
Is there any way to force drupal 8 to generate these images?
My problem is, that sometimes they are being generated, sometimes not, sometimes after visiting the page for many times
Was the clue that helped fix my problem on 8.2.2
Drupal 8.2.2
My problem was that a custom content type, which included text fields and an image upload field, would not create or show the image thumbnail on the form after a user browses for an image and selects it for upload. After a crazy amount of searching for clues, following f1mishutka’s idea, I commented out the SetHandler reference to SA_2013_003 in the sites/default/files .htaccess file, and added a SetHandler set to ‘none’. Then cleared cache.
After that, the file upload thumbnails were generated and visible . Then I uncommented the SetHandler reference to SA_2013_003 and commented out the SetHandler ‘none’ setting. (So, back to the original settings) – and the thumbnails now show up when a file is uploaded.
Can’t say I really understand why.
(My first comment on d.o - Invaluable community)
+1, Above suggested solution
+1, Above suggested solution worked for me
Life saver
This is working but I am not sure why the files are not even created inside the image style folder.
It works for me too.
It works for me too.
Thank you thank you
Got mine working with this advice! Thank you!
Broken Image Styles Drupal 8.1.9
I'm running 8.1.9 and all image styles are broken (drupal default and my custom styles). All images work perfectly if the style is set to None (original image).
All sites/default/files and files/styles and accompanying subfolders are set to 775 and all have .htaccess folders with the following:
SetHandler none
Permissions and the htaccess thing are the only possible solutions I've found after several hours of googling. Neither solutions have worked for me.
Domain access locale can cause this issue
Had the same issue. Instead of generating thumb in some image style I was redirected to home page. Then started turning modules one by one and found that Domain access Locale is causing this. Later found that bug is already submitted:
https://www.drupal.org/node/2573879
And comment #11 did the trick form me! Hope it will help someone.
are you talking about drupal
are you talking about drupal 7 or 8? How to apply this to drupal 8?
File Permission to 755
Hello,
For Drupal 7/8, set media files permission to 755 and Broswer will render them correctly.
Hope it will help.
Drupal 7
This issue caused by SMTP module is for Drupal 7 only as far as I know. Didn't use D8 much so far. But anyway, it's possible that some other module is causing the trouble so turning them off temporarily and checking won't hurt.
Files Permissions in Files directory
This has happened to me many times when moving a site from dev server to live server. The problem is always caused by file permissions in the sites/default/files folder.
Hope this helps.
Found a resolution that worked for me
Hi, I'm usually more of a reader than a poster because almost all problems have a solution already, but this problem seems to be lagging on without any solid answers. While this isn't exactly a super solid answer because I don't know the exact cause of the problem and I did a few things and it could have been a combination of them or just the last thing that I tried.
If you have the Devel module installed, clear the cache using the module. ( Press the Devel tab in the toolbar and then select the "cache clear" tab that pops up in the toolbar below ). Clearing the cache using Devel was the last thing that I did and I think it would be best to just do this first instead of changing all folder permissions to 777, which is what I did first off and I didn't have luck after I just changed permissions and cleared the browser cache, but using Devel cache clear worked for some reason..
I don't think that my folder permissions were poorly set, but I was grabbing at straws.
I am developing using Dev Desktop on a local machine in Google Chrome and in developer mode and I have the cache disabled so I don't understand why I had to clear the cache. On top of that, just for more straw grabbing, I tried clearing the cache in the browser like I said above before finding the "cache clear" option in Devel, and it didn't work. Maybe Devel performs extra steps while it clears the cache. I don't know because I'm quite new at developing and ultra new at Drupal. Maybe someone shed some light on that.
Anyhow, I hope this helps someone because I was searching for an answer with no luck for a while.
Thanks for the awesome
Thanks for the awesome suggestion about devel cache clear. I can confirm that this does work, although I am not sure why you have to do ti this way rather than just through a regular cache clear or drupal cr all.
I will also note for other people running into this, that if you change your file permission as suggested by previous comments BEFORE you create any custom image styles you have a much better chance of avoiding those style being broken. Changing permission afterwards did not fix the issue for me until I cleared devel cache.
Devel Cache Clear
ktobiasson, the Devel Cache Clear worked for me on D8 (Acquia Lightning 8.x-2.13-core) - thank you! The other suggestions about changing file permissions or .htaccess settings did not work in my case. And those did not really make sense because the image style directories were being populated automatically for awhile, and then just stopped working one day. Not sure what changed.
THIS WORKS
Thanks @ktobiasson for this solution! Like several other people who have commented, this issue arose suddenly for me after checking out site from Acquia Cloud to local Dev Desktop—all had been working 100% correctly over the course of many push/pulls of the codebase, then suddenly no thumbnails, no image styles generated.
I tried every singe permissions and .htaccess solution proposed above and none of them work for me.
I do not even use the Devel module, but I installed it and simply cleared the cache as suggested... and image styles are all working fine once more. Such a bizarre issue—no Drush cc, cr, or if would resolve it, but Devel Clear Cache did. If anyone who is more familiar with Devel comes across this, maybe they can suggest what it's doing that we could use as reference to fix this issue.
Thanks again to @ktobiasson and all other commenters for the guidance on this.
Thank you, this works
I searched high and low for a solution to this problem. I finally came across this, and Devel cache clear immediately solved the issue.
This worked for me after
This worked for me after trying at least a dozen other seemingly logical but complex solutions. Thanks for sharing!
I had the same issue, but
I had the same issue, but this trick did it for me too!
This worked
Incredibly, this worked for me, too. I couldn’t tell you why, but going to (Admin bar)/Configuration/Development/Performance and clicking the “clear cache” button worked a treat. Thanks for taking the time to post!
+1 for this solution. I don't
+1 for this solution. I don't understand why but it worked immediately. In case this is relevant I am also using Acquia Dev Desktop.
Strangely the images do not appear in the directory itself but they do load in the browser. None of this makes any sense at all.
itok may be the cause
Try popping this in your settings.php
Ditch itok
allow_insecure_derivatives works
the allow_insecure_derivatives line worked for me when there were forbiddens and I knew the permissions were okay.
This issue depends on the
This issue depends on the hosting, tested it, i got a hosting with namecheap and works fine no changes to the settings, then we have another account with x10 hosting, here with them, i have this issue!! Folders are not being created on the fly, permission denied & so on.
Another reason it can fail
As this comment seems to be the top hit for "Drupal 8 image styles not created", let me add that styles are created by a call from Drupal to itself. As this is an internal call, there's no need for https. In my case, I had been messing around with http2, which works over SSL - so it's encrypted - aka https. While I was doing this I broke the plain old http of my webserver, and bam!, image styles broke. As did image and media uploads.
if Running Drupal in Docker and get this...
It was permissions of the var/www/sites/default/files/styles folder. I tried to clear the cache with Devel as suggested above but no dice. When I updated the permissions of the folder images showed. So if your running a dev environment behind a firewall and just simply want to get something up and running then chmod 777 -R the styles folder. Otherwise if prod... then a more secure solution will need to be introduced.
As this is still a top result hit"
I was continually running into this in D8 for the last year, I think I finally found what made it go away.
Using Acquia Dev Desktop,
This tool creates a *symlinked* alias from sites/my.site.dd/ to sites/default/ - which means *most of the time*, most things work.
However, when accessed via the web, half the site *thought* that my site name was my.site.dd, and would generate URLs to /sites/my.site.dd/files/styles/medium/img.jpg
This would NOT WORK and the image would not be generated.
I would get mixed results when using drush, as drush may or may not recognise the site id depending on the context I was in when I called it.
...and, um , never mind...
LONG STORY SHORT:
My problems went away when I added
to my settings.(local).php.
ALSO a solution, was correctly updating my /sites/sites.php alias array to include the
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Nothing works.
I am using PHP7,drupal 8 in apache RHEL still I have same issue
I'm in a similar boat
I'm running PHP 7, D8 and CentOS. I tried rolling back to PHP 5.6, and my sites were still experiencing the issue.
It seems to be limited to files in the private file system though.
Solved
Looking at watchdog messages I fond that thumbnails are not generated due to pgpGd error, since I was manually install the php in RHEL it was fix by configuring phpGd with php and jpeg support.
http://php.net/manual/en/image.installation.php
@dman, Settings the file
@dman, Settings the file_public_path variable as you suggested worked for me.
Going further on this…
And, going further down this line:
I recently relaunched a site (D7 to D8) where I was using Capistrano deployments, and shared folders, such as sites/default.
Naturally, I went to set the
to its shared folder path.
Everything was working fine on the site, aside from this issue, with little other indication of issues. I could generate images at will on local dev sites, so couldn't see what the problem was, and looking at system logs only related that the image style couldn't be found. Of course, this was because the style wasn't there, but gave no further indication.
I tried all the other solutions here, including the .htaccess fix, the file_public_path and suppression of itok, but to no avail.
Once I commented out the file_public_base_url, all was OK. Running
confirmed this.
I want to add an addition to
I want to add an addition to this. This was *exactly* my problem. Dev Desktop creates a symlink site directory that points to the sites/default directory.
The main problem here is that the Image module generates a cached route to the public://files/styles location. When you first access the page via the browser, that path is sites/[symlink name]/files/styles and that gets cached. If however you bootstrap the site through a drush command, that route will be built as sites/default/files/styles and then cached.
When a file such as sites/[symlink name]/files/styles/example.jpg is requested, the Image module changes the requested route to the directory path of the image, and returns that path for route processing. If the route was initially generated during a drush bootstrap, then it will not match the route requested by browser, and a 404 will be generated.
If you or your process requires both that site directory symlink, *and* the use of drush for cache clearing, either follow the instructions of explicitly setting your public files folder, *or* instruct drush on which site it is clearing using the --uri=example.com command. (for example: "drush cr --uri=example.com" )
hope this helps someone!
Drupal 7/8 Nginx itok issue
I had a similar issue (re-)generating image styles.
The ?itok= security token was added as of D7.20 to address denial of service vulnerability
Include this in your Nginx configuration:
}
I haven't looked into Apache servers but there must be a similar rewrite rule for Apache as well.
Anyone know the equivalent Apache?
I'm still having this issue, and nothing above has helped.
Drupal 7 + nginx. Using
Drupal 7 + nginx. Using drupal in a subfolder.
I'm gonna leave this answer here just in case. I tried most of the answers here. It wasn't a permissions error, and I was not getting any errors on watchlog or php/nginx logs. I was restoring a site from a backup (backup and migrate).
In my case, disabling clean urls solved the problem. So I have the suspicion that we have something misconfired on Nginx about having drupal sites on subfolders (eg: domain.com/drupal1, domain.com/drupal2)
I've been working on this for
I've been working on this for over a month. I can get it to work but only if the styles folder is 777. I have deleted all images styles from drupal and then deleted the styles folder to narrow the scope (it remakes automatically). Changing owner and group or either has had no effect at 775 it works with any owner group at 777 when the image styles directory is built after creating a new style, it will be at 775 and they work fine like that. If the styles folder is changed back to 775 it wont work. I'm not using styles because I don't want to keep it at 777. The site is live and already a lot of work. Dont need security issues.
If 777 works, but 775 does -
If 777 works, but 775 doesn't - it's very much likely that it is just an ownership problem. Did you check all the available error logs?
In order to generate the folders / files etc. the user used by the web server must be able to write into these folders. I think in most situations that would be the user "www-data".
I like cookies!
I had the same issue and it was because of Nginx
I found a solution for my issue here:
https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/
Didn't seem to work for Apache though
Just noting for anyone else...
Varnish Cache problem
Hello everyone!
I am the original Author of this long thread,
I were almost forgotten about this old thread - and the Problem was partially resolved long time ago - but it was very persistent problem - so:
1. Suddenly on a production site - I was not able to produce Image Styles....
2. Came Host - also could not really resolve this problem
3. then I found out to my Surprise - I can work with images ending .JPEG , but cannot with .jpg .....
4. after some 6-8 months of struggling - my Host said - Now they are able to add me to exclusions of their new Varnish Cache, so my images are now excluded form Caching serverside....
5. well, may be not really perfect solution, but my problem was solved...
Same resolution
I've been evaluating a new host with a D8 site and hit problems with image styles not being generated. I tried many suggestions from reading many posts. In the end the solution was to switch off Cachewall in the hosting panel. It appears to be messing with permissions so I've contacted the hosting service to see what can be done.
caching and itok
Hey Mate,
TBH I don't see how cachewall could mess with permissions. Some caching sytems are simply incompatable with itok.
Here's the solution and to anyone else using a 3rd party cache such as Varnish, add the following lines to settings.php, then obviously clear cache:
d7
$conf['image_allow_insecure_derivatives'] = TRUE;
$conf['image_suppress_itok_output'] = TRUE;
d8
$config['image.settings']['allow_insecure_derivatives'] = TRUE;
$config['image.settings']['suppress_itok_output'] = TRUE;
I'll check this out
Thanks for the suggestion. I will try this when I get a chance and post the outcome.
@Andrew211, thank you!! That
@Andrew211, thank you!! That worked for me.
this works for D7
I updated to the latest d7+various 2015-era modules on 2018-02-01 and, I don't know where in the stack a change was made in caching, but URLs to all of my derived images in ...images/styles/* were ending in the ?=iotk+ gibberish
Adding these two comments to settings.php fixed it (the last one mostly, I'm sure), though I am wondering what caused the problem.
d7
$conf['image_allow_insecure_derivatives'] = TRUE;
$conf['image_suppress_itok_output'] = TRUE;
This works for me, Thx
This works for me, Thx
Cachewall not playing well with Drupal image generation
Have been struggling with image handling on my Drupal sites for months. Wish I had discovered this thread earlier.
I'm on shared hosting and after messing with folder permissions, php versions, manually creating styles folders and all sorts of things, simply disabling Cachewall solved the problem immediately.
This was a tricky problem as it took a very long time to diagnose (I would still count myself as a novice). Neither my hosting provider nor my theme developer could figure it out.
Posting this here as a +1 for the Cachewall solution
Hi,
Hi,
This is going to sound silly, but did you try setting another theme as the default and then switching back to your desired theme? For some odd reason, after i switched to another theme and then back, the image styles were generated. I did not have to do anything else.
Worked even for 8.4.4
Hello, https://www.drupal.org/forum/support/post-installation/2015-06-16/image-... worked for us with 8.4.4
in settings.php we added:
we needed this never before but after complete new setup/migration (with existing config) of a site and an updat from 8.3.7 to 8.4.4 no images style-pics were rendered, thanks for this solution.
This worked for me.
This worked for me.
This worked for me.
This worked for me.
This worked for me on Drupal
This worked for me on Drupal 8.5.3
Image styles
Image styles not generating you Please store it
Unfortunately none of the
Unfortunately none of the suggestions thus far have worked for us on 8.4.4. Oddly enough, the problem only exists if we block hotlinking of apk, log, and pdf files in our conf.d file...
https://drupal.stackexchange.com/questions/255474/image-styles-not-gener...
another twist!
I recognize a few of usernames on this tread. That makes me think that this is not a trivial issue.
php: 5.6.36 - apache: 2.2.15 - drupal 8.5.3 - rhel server
If I use the local file system image styles work as expected. But switching to NFS file system [ nfs (rw,nfsvers=3,addr=nnn.nnn.nnn.nn)] results in: Unable to generate the derived image located at public://styles/thumbnail/public/uploads/images-slide/1.jpeg
My styles directory is owned by apache:web
There goes my weekend!
Nginx
In my case nginx was a reason of this problem. Instead of going through custom server configuration I installed Imageinfo Cache module and it helps me. I hope this solution helps someone else too.
In my case problem resolved by edition .htaccess
/sites/default/files/.htaccess
- Options -Indexes -ExecCGI -Includes -MultiViews
+ Options -Indexes
detected by review error.log in apache
it did help in my case by edition .htaccess
it did help in my case but i don't know why? i have created a new content type with multiple image field and started slowly add content. a few weeks later when new content that i add of this content type stoped render thumbnails for images same case when i edit older content (change images). anyway solution by
kyryliv helped
Please explain somebody what we do by those changes. THANKS
possibly due to CDN module
I saw this issue when using CDN module. Turned off the module and image thumbnails started working. Turned it on and thumbnail generation failed on CDN request.
I'm facing this problem, did
I'm facing this problem, did you find a solution?
SOLVED - it was a cache problem
I confirm, for me it was a cache proble (Varnisk).
Hosted on Fastcomet, I had to go in the Cpanel and open Cachewall.
Then just stitch off for your drupal url.
Easy, but it took me a long time :-)
Hope it helps !
Nginx static file delivery was at fault for me.
If you use Nginx, you'll need to ensure that, if you've used the Nginx Drupal Recipe, that you have the "try_files" directive in that location block!!!
INCORRECT CONFIG
CORRECT CONFIG
Hope this saves someone's time!
Credit: This post on Drupal Stackexchange pointed me in the right direction.
yes, that is correct
yes, that is correct
here is from my config
```
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
try_files $uri @rewrite;
expires max;
log_not_found off;
}
```
but
try_files $uri @rewrite;
is placed at the top
Thanx Man!! This solved my
Thanx Man!! This solved my issue as well. But I had a dev server which didn't have this directive and everything seems to be working there. Have to figure out why is that?
503 Failed to Load Resource - Images
Drupal 7 - Image Style - Views - Views Bootstrap - Bootstrap Sub-theme
Try the following one at a time:
ini_set('memory_limit', '512M');
helps give site more resources to loadPosting in case someone else runs into this issue...
I was having trouble, specifically with images in JPG format. Original image was there in "sites/default/files" but could never generate styles off that original image. Apparently GD image toolkit has libraries to support different image formats.
Thanks to this thread, I ran a command to see GD's information output, to see if this was the issue. Sure enough - JPG library was not compiled. So for me, the answer was to compile PHP / GD Image Toolkit with JPEG support. Hope that helps someone save the multiple weeks it took me!
Drupal 8 Image styles not generating
I had the same issue and after tried all the sugestions. I solved add this line in settings.php
$config['image.settings']['allow_insecure_derivatives'] = TRUE;
It seems that my server (The specific characteristics of hosting: shared plan with cpanel) as some security issues with https, because cpanel generate SSL Certificate for free but is not enought, so the styles images are not generating.
Setting the configuration
Setting the configuration setting: $config['image.settings']['allow_insecure_derivatives'] = FALSE is a default security fixed going back to Drupal 7,20. Drupal core's Image module allows for the on-demand generation of image derivatives. This capability can be abused by requesting a large number of new derivatives which can fill up the server disk space, and which can cause a very high CPU load. Either of these effects may lead to the site becoming unavailable or unresponsive. Setting the "allow_insecure_derivatives" to "FALSE" is a security fix that changes all image derivative URLs generated by Drupal to append a token as a query string settings meant to address this vulnerability.
If your watcdog shows file not found errors when generating image styles, I would suggest rechecking the folder permissions or using Devel module to clear-caches as mentioned in other threads here.
ReggieW
I have built many Drupal
I have built many Drupal sites and have never met this problem until now. I am finding that image styles are not generated until a cron run takes place.
Does this provide any clues about what is going wrong?
---
Paul Driver
www.easable.uk
Ilkley, West Yorkshire, UK
Me too run into this issue, - Watch out for rewrites
Me too run into this issue, even though image styles were working fine before. I also couldn't solve it so far, after trying everything here.
Styles folder have 755 permission and I'm able to write files with the Apache user. GD library is also installed, supporting JPEGs.
I cleared cache, flushed image styles and even tried with itok disabled etc. but nothing helped.
Anything else we can check? :)
UPDATE: Fixed! I noticed that it worked without clean urls, thus realised it was an issue with rewrite rules, after inserting the rule for the folder location it worked again
Please clarify
Hi @markusd1984 — we are still stuck after having tried all of the above solutions. Can you please clarify where you inserted this rewrite rule?
Rewrite rule for .htaccess
The above mentioned Rewrite Rule is placed in the .htaccess at root of your drupal install.
Insert before RewriteRule on line 122 below
For D7 .htaccess in the root
For D8, find similar lines in .htaccess in web folder.
I was facing same issue in
I was facing same issue in drupal 8, I followed the following steps. (This issues was on local [Windows 10 with docker] so this only for LOCAL environment and not for Production environment)
After this I can see images are loading on site.
It works for me
Thanks, It works fine for me.
Thank you
Your solution is very good. It is working for me with drupal 8.9.
Thanks for your help.
Check the image style exists!
I had a site where the image style was not being generated and it turns out the image style did not exist! Worth checking...
GD2-toolkit - no thumbnails
Hi,
I installed media and media library.
I am on an Ubuntu PC with docker environement for my Drupla 8.8.2 install.
(PHP 7.3.14, Apache 2.4.38, MySql 5.7.29)
When I try to upload an image I get this error:
Warning: imagesx() expects parameter 1 to be resource, null given in Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute() (line 67 of core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php).
Warning: imagesy() expects parameter 1 to be resource, null given in Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute() (line 67 of core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php).
Warning: imagecopyresampled() expects parameter 2 to be resource, null given in Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute() (line 67 of core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php).
Warning: imagesx(): supplied resource is not a valid Image resource in Drupal\system\Plugin\ImageToolkit\GDToolkit->getWidth() (line 328 of core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php).
Warning: imagesy(): supplied resource is not a valid Image resource in Drupal\system\Plugin\ImageToolkit\GDToolkit->getHeight() (line 343 of core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php).
All other functions of the site are OK.
I can also upload PDFs with media manager but not images.
thx.
Varnish
I went crazy trying the options above but in my case it was a Varnish issue. When I disabled varnish everything went back to normal. This was happening in my test environment only so disabling varnish in test is not an issue.
Drupal 8, CentOS VPS
All the members ’comments were not helpful to me .. In the end, Drupal documents were useful .. https://www.drupal.org/docs/security-in-drupal/securing-file-permissions...
i use Drupal 8, CentOS VPS
It becomes a problem when we cache image styles with Varnish
We are using currently Varnish 6 with ssl termination on Apache 2.4. The problem persists and a possible (but not best) solution is to exclude the path for the image styles from caching. Then the image styles are rendered as expected.
sub vcl_recv {
# Do not cache these paths.
if (req.url ~ "^/status\.php$" ||
req.url ~ "^/update\.php" ||
req.url ~ "^/install\.php" ||
req.url ~ "^/apc\.php$" ||
req.url ~ "^/admin" ||
req.url ~ "^/admin/.*$" ||
req.url ~ "^/user" ||
req.url ~ "^/user/.*$" ||
req.url ~ "^/users/.*$" ||
req.url ~ "^/info/.*$" ||
req.url ~ "^/flag/.*$" ||
req.url ~ "^.*/ajax/.*$" ||
req.url ~ "^.*/styles/.*$" ||
req.url ~ "^.*/sites/default/files/styles/.*$" ||
req.url ~ "^.*/ahah/.*$") {
return (pass);
}
We have to address the issue and handle it to the group which works with Varnish implementation.
Hi. I have the same issue
Hi. I have the same issue with OpenLiteSpeed. I read all comments on this post but can't resolve my issue.
I created an issue separately for that. please help if you can
https://www.drupal.org/forum/support/post-installation/2021-11-23/drupal-8-cant-generate-image-style-on-openlitespeed
www.drupalion.com
From f1mishutka's answer
From f1mishutka's answer
I had this issue on a Windows 10 and to bypass it in localhost, the Following was suffisant :
is sites/default/files/.htaccess
Twitter: @ismaeil_
From f1mishutka's answer
From f1mishutka's answer
I had this issue on a Windows 10 and to bypass it in localhost, the Following was suffisant :
is sites/default/files/.htaccess
Twitter: @ismaeil_
Apache 2.4, spaces in filename
An Apache security update causes spaces in filenames to trigger "AH10411: Rewritten query string contains control characters or spaces" errors in the error log, and "Permission denied".
This is because the spaces get double-encoded during the rewrite process. I find that a fix is to change the index.php rewrite rule from
to
The "B" flag says to not encode spaces and question marks during the rewrite, and QSA allows any
itok=
URL parameters to be appended to the query string.http://www.fonant.com - Fonant Ltd - Quality websites