Switch images to ‘Media File’ in bulk
-
I know this isn’t the right place to ask, but I cannot find the answer anywhere. I started linking my images to the attachment page a while ago. I have thousands of images linked that way. Do you know if there’s a tool to relink them all back to the media file in bulk?
-
Hi @digitalrenewal you’re not the first one to ask this. I have not found a solution though… I would guess that is because there are so many ways an image could have been inserted into a post.
For one: either using the older TinyMCE based WordPress editor, or the new Gutenberg editor. Or either as a single image or a gallery, using a shortcode or… Well, you get the point.
A fix-all solution will probably not be easy, if at all possible. So how did you insert the images? Do you have a link to an example page on your site?
It’s a total mess, I might even just rebuild the darn thing. I started the site before Gutenberg. I uploaded images from inside the post, back then it was using TinyMCE. So those are linked to the media file and should be fine.
I started linking to the attachment in 2019. So that would be with Gutenberg. Later in 2019, something broke. When I uploaded images through the Gutenberg editor. It could not attach images to the post and was writing image links like this: https://mysite.com/?attachment_id=9346. I didn’t notice that for, oh, about 100 posts. So THEN, to get things to link correctly, I had to… create the post. Upload the images through the media library. Attach those images to the newly created post. Then add the images to the post. yeah.
So now there are 3 different ways images are linking on this site. For now, so I don’t anger the Google gods, I’m using Yoast to redirect attachment URLs to the media file. It doesn’t make the plugin work, so I’m sorry I didn’t help you there. If I do find an easier solution than a rebuild, I’ll come back here and let everyone know.
It could not attach images to the post and was writing image links like this: https://mysite.com/?attachment_id=9346. I didn’t notice that for, oh, about 100 posts. So THEN, to get things to link correctly, I had to… create the post. Upload the images through the media library. Attach those images to the newly created post. Then add the images to the post. yeah.
That is not normal, even for Gutenberg in the early days. Maybe a conflict with a plugin?
And at this moment? Does it behave as expected when inserting a new image?
In any case, it sounds like there is no other solution than going through old posts to manually modify the inserted image blocks…
I thought that too, that it broke somehow, but then it did fix itself.
Unfortunately, I’ve come to the same conclusion. It will need to be corrected manually. I’m ready for the challenge ?? Many of those images were built into galleries, so it will be easier to switch a whole gallery to the media file than one at a time.I had a similar issue with an export/import when moving an old site, where the attachement IDs dis not correspond anymore breaking many galleries. I found out after manually recreating several galleries, that a quicker solution was to switch the image size to full then back to medium, which somehow fixed/reset the broken galleries. Not sure if this (or something similar, jiggling other settings) could work for you, but it’s worth trying ??
Good luck!
oh, that’s smart! I’m glad you found an easy way to fix it. it’s ironic too, I set all of the image sizes to zero because my images are hyper-optimized and WordPress was making them larger. (and I have 10,000 images and don’t want to overload the server)
There’s so much wrong with this site, I’ve finally started to rebuild it from scratch. I’m looking at your plugin again. What I really want is a print button to print each individual image. I thought a lightbox would be the easiest way. Do you think I would be able to append a print button into the fancy box? I have the print code written with a modal but I’m not a good enough coder to get it into wordpress. If I could insert it into a simple lightbox that would be clean and easy ??
Hmmm, clean yes but not easy ?? … there may be another light box plugin out there that has this already integrated as an option. If not, then tell me, what is the code you already have written but cannot get into WP?
I looked at most of the lightbox plugins but didn’t see it. I have it plugged into a simple modal code but here’s just the code for the button. I don’t know if there’s a way to get it on a page with 20 other photos and print the right one.
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('.clickPrint').click(function(e){ e.preventDefault(); var w = window.open(); var print = $('.imgToPrint').html(); w.document.write(print); w.window.print(); w.close(); return false; }); }); </script> <style> img {width:30%} a.printBtn {display:inline-block; background:green; margin-top:10px; padding:10px; border-radius:10px; color:white; text-decoration:none;} </style> <a href="#" class="imgToPrint"> <img src="https://live.staticflickr.com/5204/5329887147_df9eb8f541_z.jpg" width="100%"> </a> <br> <a href="#" class="printBtn clickPrint">Print Me</a>
- This reply was modified 2 years ago by digitalrenewal.
- This reply was modified 2 years ago by digitalrenewal.
- The topic ‘Switch images to ‘Media File’ in bulk’ is closed to new replies.