Broken Images in Media Manager in Wordpress 4.7 - wordpress

We had an issue on our server which resulted in our entire 'wp-content' directory getting deleted.
We restored the themes, plugins and some of the images but we're now left with allot of broken images in the media library. We cannot re-upload and fix all of these broken images as the majority were generated from a feed which uses unique filenames etc..
Screenshot:
My question is simply, how do I quickly and easily remove all the broken images from the media library? They are obviously in the database and I just need to remove them.

If the files itself are still exist in the server with their original names in the time you uploaded them so you just need to generate again the thumbnails and there is a plugin called Regenerate Thumbnails that allow you to do it simply within a click.
If the files was restored without their original names, it will be actually impossible to recover them automatically because the system donesn't able to attach the uploaded files to the posts they was attached before.
You will have to delete all images that not linked to actual files and for now you will have to do it manullay because there is no plugin (at least not in WordPress repository) that offer this functionality. There is a plugin that called "Broken Images" that it's not updated for 2 years. I will not recommend to use it. I also searched for a plugin with some functionality but I didn't found and decided to develope it by myself. I'm going to release this plugin soon.

Related

Wordpress - Images not showing up in Media Library

for some reason, WordPress images not showing up in Media Library since yesterday moreover when I try to upload an image is getting the error "An error occurred in the upload. Please try again later.
I tried everything I read, fix permission, update everything, disabled all plugins, enable default theme, install some plugins like Hotfix, and Media sync, etc upgraded PHP with no luck,
when I'm going to the Media library the image is like grid view
when I'm going to list view it shows blank thumbnails without the option to delete them.
list view
could you please help?
My guess is the allowed memory limit for PHP needs to be increased. If you have access to update this values, consider updating it. It's found in your php.ini files. The default is usually 64MB. You could try adding multiples of 64 MB. So 256MB should be fine. Good luck!
Another update is that when in the library is selected “All media items” and “all dates” not showing anything if i choose a specific month it shows the media.
Moreover if i delete the folders from the upload it still available in the gui bit without photos.
But im still facing issues to upload or to see all the media.
After my deeper investigation i figure out the following the "no title" created every time im trying to upload a photo.
there are 2 issues
i have set the media settings to Organize my uploads into month- and year-based folders
But when im uploading a photo for some reasons the upload goes in older folders and not Feb 2023.
if i disable this feature then the photos upload goes to the roor of the upload folder and again in the library shows error.
if i manually upload the photo via FTP in a specific folder also the last uploaded file shows as "no title"

'Visual Composer' plugin is outputting weird image links

Morning everyone, i'm having a super weird issue with my recent wordpress migration. I moved the (working) site to another webspace and i'm slowly running out of ideas (jk, already ran out).
Issue: After the migration, the plugin Visual Composer is outputting nonsense image links to the frontend that look like this: https://i.imgur.com/7RocCmE.png instead of the uploaded images url. Result: No images are showing on the frontend.
This issue only happens when i use the single image block provided by VC itself. Inputting an image the wordpress way, inside of a text block, works.
What could be the reason for this? i'm super thankful for any advice since i'm not a programmer.
I have already tried:
Enabling wp debug, not getting any errors
Installing different versions of Visual Composer, multiple times
Reinstalling Wordpress, multiple times
disabling all plugins
completely reinstalling and reuploading everything from scratch
different php versions
As I saw in your screenshot with the src attribute of your image and it has data-src attribute also, I think that it's because the new site (or maybe the new hosting) is using lazy load which will update all images source of the site to the lazy load image for better performance.
Lazy load images mean that the image won't load at the beginning, when you start to scroll down to each section, the images of this section will be loaded. In this way, the site will be optimized and won't load many resources at the beginning.
I think you can:
Check if there is any cache plugin installed, try to deactivate this plugin.
Check with the hosting provider if there is any cache setting installed, try to deactivate this setting also.
See if the image is working in the backend or not, if it's still loaded in the backend, I'm pretty sure that it's the cache issue. If it doesn't load in the backend, I think there is something wrong with your theme source code.
Compare the hosting environment, especially the PHP version of the old and new site to see if there is any differences.

Photos not uploading in Wordpress media manager

I am trying to upload images into the media manager of a Wordpress website for my clients. No issues last time I touched this website, which was about a month ago.
So far, I have:
Tried uploading images that are already in the media manager (same size, file, etc)
checked all permissions in the FTP (all permissions are fine)
disabled each plugin, 1 by 1, until all were disabled to test if that was the issue (it wasn't)
uploaded an image directly into the FTP to get it to appear (it didn't)
reset the upload location for the media manager (thought that was the issue, but it wasn't. More on that below)
made a lot of grumpy noises
tried uploading different files (didn't work)
Reinstalled the latest update of WP
So far, here's what I know:
When I click "edit image" the image appears in the editor
In the FTP, when I upload the image, it appears in the appropriate folder (public_html/wp-content/uploads/2021/11)
when I access the image from the FTP, it is there in all dimensions as created by WP
The URL of http(s)://company.com/wp-content/uploads/2021/11/name.jpg brings me to a blank page
No errors are returning in console expect that there is a missing resource
It's even worse on Safari (as opposed to Chrome), where none of my images are appearing
So far, every answer I can find for this problem involves the permissions for the files, none of which seem to affect anything for me. The files upload automatically at a 644 permission level, though I can change them to a 744 and still get nothing.
SOS and thanks for any help!
Unfortunately, I don't have much of an answer as to why it works, but I do have a solution.
I backed up my WordPress site using a plugin, then restored the backup. My plan was just to do the backup, then restore an old backup, but just in case I tried restoring the backup I just created seconds before—and voila, it worked. I don't know why, but hey! I have a solution.
So make a backup, and then restore that backup.
Thank you to #bossman for helping out in the comments.

Images not working in wordpress installed in a subdomain/subdirectory

I installed a copy of another wordpress installation of a client in a subdomain. All seems to work fine but images don't. I'm using videos as background and they are working perfect. If I take a look inside the media menu the images are not visible (you can only see an X for every image), but if you manually take the link of every image all the links works fine and images are accesible.
I suspect that issue is related with any of the functions that process images. Maybe some kind of error related with the subdomain which obviously have a dot in the domain name.
¿Any idea?
Thanks in advance!
I assume that you uploaded the images of the client's WordPress installation via FTP.
As far as I know WordPress Media Library cannot “see” images that are not uploaded through the Media Library uploader. The Media Library uploader (aside from uploading your media) creates necessary references within WordPress which you don't have when uploading media via ftp.
This is a common WordPress flaw. There are plugins which might solve your problem by creating the necessary references after such a ftp upload, e.g. Add From Server.

Adding plugins that required database changes to version control on Wordpress

I'd like to add a installation of a Wordpress site to version control. After researching a little bit, I found some files/folders that should be ignore, like sitemap.xml and cache folders.
Every single one of them say I shouldn't ignore wp-content/plugins/, which is a reasonable advice at first. The question is: How should I deal with plugins that alter the database?
I can see two scenarios:
If the plugin has to add some tables on installation, this trigger would be lost since it would already be "installed" after uploading the files to the server.
If I must access the installation screen on production, then there's no reason to version control these files.
I would suggest to take a look at this great presentation. It's the most complete I saw yet.
http://stevegrunwell.github.io/wordpress-git
You should have your plugins directory in there too since you do want to track plugin files. As for the database, that's another subject completely. Take a look at the development of VersionPress, it should be out at the end of the year.

Resources