Images styles are not created in drupal 7 - drupal

I have a website in drupal 7.53. When I try to upload an image in my article, it shows the image as a cross (image not found). For testing pruposes, I've set my folders to 777:
sites/default
sites/default/files
sites/default/files/tmp
But no luck.
Edit:
I've changed the "clean url" option to no clean urls and now it starts working. So I've replaces the .htaccess file to the default drupal file, but still no luck when I turn on "clean url".

From my experience most common reasons that can cause image style image creation failure are:
GD library not installed or not working properly
Wrong file permissions (php can't upload/write file)
Domain access module (it's "Locale" sub-moduel) - there's a bug in that module which messes up the image paths.
.htaccess file (some wrong options)
What I would do is try the fresh installation on same environment and if it's working well there or not and then I would switch off temporary module by module to see what is causing this issue. Also try switching to default Drupal's theme to see will it happen with it too.

Related

Wysiwyg image is showing up in media/wysiwy not inside pub/media/wysiwyg. How do I fix this?

Okay so I have a Magento 2.4.5 project where I am facing some issues like images not loading up because they are being looked up inside pub/media/wysiwyg instead of media/wysiwyg. I have some wysiwyg images inside pub/media/wysiwyg/<some_image_directory>, however on the live site the directories and files are showing up as media/wysiwyg. How can I make sure that a separate pub/media/wysiwyg directory is created in the live site apart from the media directory that is already there such that the image loads up properly? We are using nginx which is opening up at 'pub' directory as the root where the media directory resides. Any help is appreciated.
I tried checking for the piece of code where the image is coming from in an attempt to see if the path can be changed programmatically by removing the 'pub/' part from the pub/media/wysiwyg/ for the live site. However, that is not something that can be done as that will change things project-wide, which might break other things. Hence that is not being done.
First, you need to make sure that you are running the site from the root folder i.e. public_html on the server.
Steps to reproduce:
1: Run the command to load content:
bin/magento setup:static-content:deploy -f
2: Next command: chmod -R 777 pub/*
3: Set the secure base media URL and unsecure media URL from Magento database which you recently created and find the table core_config_data and change the path value as:
web/secure/base_media_url => https://example.com/pub/media/
web/unsecure/base_media_url => https://example.com/pub/media/
Or from Magento Admin
Stores -> Settings: Configuration -> General -> Base Url's -> Base URL for User Media Files
and to
Stores -> Settings: Configuration -> General -> Base Url's (Secure) -> Base URL for User Media Files
Flush Cache
4: Might be missing .htaccess in your /pub/media/ folder.
5: Check your .htaccess file, if there's bad code.
Thanks
Okay so I figured out the issue.
I was running the website from the pub directory as I should however there was a third party plugin which had some hard-coded src set by the owner for images set as /pub/media/wysiwyg in the adminHtml since they were using an older version of Magento which used to place images inside /pub/media/wysiwyg instead.
So I just changed it to /media/wysiwyg over there and everything works as expected.
Tbh the whole issue was quite hacky as the owner seems to have put a script inside the third party module's description section in the adminHtml and is using hard-coded links such as this.
Thank you all for the comments. :)

Wordpress Failed to load resource

I'm having weird issues after installing WordPress, (using a subdomain and separate directory) it seems that files are not loading properly.
Freshly installed WordPress
Using the default theme
No https thing
I did contact the host support about this (I did assume that it's a permission issue) and he even temporarily set the directory permission to 777 and files to 666 to see if that resolves the issue. but unfortunately, it didn't. We tried everything already still doesn't work! I'm stuck
If i understand properly, your js & css files are not loading. correct?
check your js & css file path in inspect. its proper or not?
Try reloading your files, make sure your folders are appropriately named according to your code and linking between pages/folders.
Good luck
Failed to load resource: the server responded with a status of 404 (Not Found
I think the folders path is not correct.check once your files path and reload. Check once your CSS and JS path names also then again reload the page

Permalinks making images throwing 404 errors (3 posts)

I am running Wordpress 4.1. I chose the "Day and name" option for the permalinks for my site, in order for the URL to appear in "pretty" form.
However, it is giving me a problem. I notice if I use that option, all my images are throwing 404 errors. My images are uploaded into the Media Library.
I am running the site locally in IIS. I have installed the URL ReWrite Module in IIS 7.5 already
what should I do to avoid this problem? Should I add an image handler in web.config? for those of you who had this problem, please help.
Thanks
I just ran into this same problem. There is an option called 'fastcgi.impersonate' in your php.ini file that does not get set correctly in the latest PHP installer for windows. I also noticed that all of the sized images that are generated when you upload to the media library were able to load, just not the original image.
You need todo 3 things:
1) Add the rewrite rule if you already haven't
2) Open php.ini and set 'fastcgi.impersonate=1' and restart IIS
3) Ensure the 'IIS_IUSRS' group has modify permissions to the 'wp-content' folder
I fixed this before images were uploaded so you may have to change the permissions for the entire uploads folder if you have pre-existing content.

Drupal: imagecache doesn't generate images

So, I have a strange issue with Drupal imagecache.
When I upload an image, the image is correctly stored in a folder, but imagecache doesn't generate the other cached images.
It doesn't work anymore after I moved the website from development server to the production environment.
The production server is IIS7.
All the "files" subfolder have both write/read permissions, imagecache module is supposed to create folders inside "files" folder.
The GD toolkit is correctly enabled (in Drupal report, imagecache module is correctly enabled). It is php 5.2.
thanks
Check out Imagecache's troubleshooting guide in the handbooks. In particular, check the logs for errors explaining where the process is breaking down.
Also, check the paths that are included in your pages and make sure they are still correct, now that you've moved the site to a production server. This issue has some more tips, specific to the path problem.
Finally, if none of that helps, check the issue queue. There are several issues related to IIS.
99% of the time when I have an issue with imagecache not creating images it has something to do with file system permissions. Verify that your web server is able to write to all of the files/imagecache directories recursively.

What should I check for when I cannot upload files into filefield CCK fields?

I have recently moved a drupal site. (both servers run on a debian based LAMP stack) Everything works great here, including the uploading of images via a CCK filefield. Original url:
dev.example.com/foo
Deploying it to a test folder on the production server to a test folder for an environmental shakedown cruise lead it here:
www.example.com/foo
Everything works here too, including image uploads. After adjusting sites/default/settings.php, then making it readonly again, I renamed the folder to its production name:
www.example.com/bar
Everything works fine here except for image uploading. I've adjusted the webroot variable within settings.php .
Things I have tried so far:
Gave php system user write permissions to sites/default/files (images are set to go in sites/default/files/images but imagecache just puts them in sites/default/files)
Enabled file php file uploading for www.example.com/bar/sites/default/files
Are there any other configuration settings I should be looking out for here? I'm running low on relevant solutions.
Edit: I had quite the typo there, I adjusted sites/default/settings.php, not sites/default.settings.php .
Your question is slightly confusingly framed. default.settings.php has no impact on Drupal -- its merely a template. The file that contains the actual database connection information and other configuration is settings.php.
You may also want to look at your .htaccess file in your root Drupal folder and try changing the RewriteBase directive to the folder you are accessing your site on. Usually you should not have to change the $base_url directive in the settings.php file that you may/may not have done. Reverse that change for now if you have (you may need to play around with that later though).
imagecache will always upload the image derivatives in sites/default/files but imagefield will upload the original image in the folder you specify (within sites/default/files). You will get a setting for the imagefield under Manage Fields->[Name of Image field]->Configure under Path Settings.
Please google to understand the difference between imagecache and imagefield. Make sure your sites/default/files (and subfolders) are writable by the apache user (usually www-data).
In such situations, its usually a good idea to pick up a book on apache (if you haven't already) and try to understand how it works. It will be time consuming but will help you out in the future when you encounter configuration issues like this.
This worked for me. When having issues uploading images to a cck field, I gave write permissions to directory:
sites/default/files/field/image

Resources