Permalinks making images throwing 404 errors (3 posts) - wordpress

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.

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. :)

Images styles are not created in drupal 7

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.

WordPress : Media Library broken images

When I upload image to WordPress, they randomly appear as broken links.
I can drop the files on the Media Library or Select the files and some files are always shown as broken.
I can delete the files and re-upload the same group and different images in the group can show as broken.
I'm sure it's nothing to with the images as they sometimes appear as broken and then sometimes don't.
Locally the upload works fine, this problem started happening on the live hosting - I thought it could be something to do with permissions but then wouldn't it show all the images as broken and not show random images as broken.
I don't get an error but a broken image icon. If I click the broken link it case me to the Attachment Details page. Sometimes the image does appear here sometimes it doesn't.
Some things to look for:
1) check if there is an .htaccess file in the wp-content/uploads folder or wherever you keep your images (make sure you have the option to see hidden files--I think they're available by default when you're using an FTP client but if you're in the File Manager of your CPanel then you have to enable this option, either before entering file manager or from settings when you're in the file manager depending on your host). If there is an htaccess file, you'll want to back it up and then research more about this before you make any changes to it. https://codex.wordpress.org/htaccess_for_subdirectories
2) if you had tried to move your default image directory using wp-config.php make sure that has been set up properly
3) check folder and file permissions settings. it's best to do this in an FTP client because if you need to change the permissions, it can do it recursively and include all subdirectories and files within them instead of having to go through into each folder and change the permissions.
http://www.wpbeginner.com/wp-tutorials/how-to-fix-image-upload-issue-in-wordpress/

Upload plugins in Wordpress running on IIS7

I have a problem when trying to manually upload a new plugin in wordpress.
Uploading media is working perfectly, and also automatically install plugins work as it should, but manually uploading plugins generate an error message:
The uploaded file could not be moved to C:\inetpub\wwwroot\Wordpress/wp-content/uploads/2010/11.
I have checked permissions on wp-content and uploads and it is set to Everyone. I do not think there is anything wrong with permissions since I can upload images, and I see them inside my uploads folder.
I think there might be a problem with the slashes beeing incorrect, does anyone else have this problem?
I'm using IIS7, Windows Server 2008 and Wordpress 3.0.1. Everything is installed with Microsoft Web Platform Installer.
I know this is way late in answering, but I hope someone may find it useful.
This is most likely a problem with the settings involving the temporary upload location.
Here is what I did to solve a similar problem:
Ensure that you are editing the correct initialization file. Putting:
in a test.php file and executing it from your web browser will get you the setting.
Look for the setting for "Loaded Configuration File"
In that configuration file search for (or add if missing) the following setting:
upload_tmp_dir = "c:\inetpub\temp\uploads"
Ensure that c:\inetpub\temp\uploads exists and is writeable by everyone. You can tighten this up with specifying the IUSR account if you wish.
Recycle/Restart the IIS worker process. Your choice here as there are a number of ways to accomplish this.
I found a good bit of this info by referring to c:\tmp\php_errors.txt. The fastcgi.logging should be enabled by default on windows installations.
Just wanna add a solution to the good Harold's answer for PHP.
Despite changing the setting "upload_tmp_dir", I was still getting the same error message The uploaded file could not be moved to C:\inetpub\wwwroot\Wordpress/wp-content/uploads.
So i have changed also the setting "upload_max_filesize"
upload_max_filesize=16M
(16M or greater depending on the wordpress's themes size file)
Hope it helps someone who was stuck like me.
With Filezilla
directory uploads>2010>11 to set permision 777

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