Let’s cut this to the chase
Here is what you need to do:
open your settings.php file and add these two lines at the very bottom, that’s what i did and worked out for me both in Drupal 7 and Drupal 8.
$config['image.settings']['allow_insecure_derivatives'] = TRUE; $config['image.settings']['suppress_itok_output'] = TRUE;
The issue is when you attach an image field to your content type, you hit the submit button, then when viewing your node, the image is broken, you try to change the folders permission but you are stuck with the problem, in the ftp tree, there is no folders being generated! Then you check your log files, you see access denied, you click on the link and indeed you get an access denied when opening the image..
This issue of the image not being displayed or folders not being generated on the fly, is on the hosting provider, i could be wrong here I say it because I have Drupal 7 & 8 hosted on Namecheap and i have no issues with them. Drupal works fine, images are being generated and folder permissions is set to 775, no issues at all.
However, we have an account with x10hosting & here is where the problem arises with them, the images are not generated by drupal on the fly. Folder permission is 755, the image styles are not generated, so the solution is, as mentions, just place the code above in your settings.php file, upload it to your server & you should have no further issues. Here is a long discussion and other ways to solve your issue if the above code does not work!