Wordpress: Is there a way to load images in Media gallery directly from disk? - wordpress

I'm using Wordpress and I've deleted a bunch of images in Media page. Since I do a regular backup of disks I can manually recover them, but once they are present in disk they won't show up in Media page because they don't exist anymore in database. I can't restore the database because I would miss lots of recently changes.
So, what I want to do is Media page to load those images directly from disk (eg: wp-content/uploads/2017/01/blabla.png). Any way to achieve this? Thanks.

In your database, you have your GUID(in wp_post table) data for Images? If you have then you can simply add your images by FTP. But make sure that you have GUID data, you have to create directory wise add your images in the upload folder.

Related

Which is faster: loading images via repo, or loading via ACF/Media Library in WordPress?

I have two methods of loading images in my mind right now during WP Theme Development:
1 - I store an image in a folder within my repo, and load it as a background image, defining it statically in CSS/Inline CSS.
2 - I store an image in the WordPress Media Library, upload it to an Image Content field within Advanced Custom Fields, and then load the src using inline styles in the template.
Which of these is faster?
My mind is telling me #1 because I don't have to go and get the img url from the uploads folder as directed by ACF, which is stored in the database but equally I don't know WordPress that well, so I might be wrong.
Thanks
Two observations:
You write that this question comes up "during WP Theme Development", and
You're loading it "as a background image".
If the end-user of the theme won't be uploading their own image for that part of the theme, then #1, the "store in repo" method, is definitely the way to go. Simpler, too.
However, if this background image is expected to change from time to time, you might be smart to leverage Advanced Custom Fields and save yourself the boilerplate code of adding image-upload fields to WP.
This being the case, you can still encourage your theme's end-users to use some cache (to cut down on those db queries to reference the image) and/or image CDN (to improve the HTTP part of the image's journey) plugins in the WordPress plugin codex.

Wordpress images no longer have srcset and are showing pixalated images

I just recently moved my wordpress site to another host. There were too many images to import so I imported them through ftp and then used the [Add from Server plugin][1] to ensure my image id and such were in the database.
Images on my new site now show up however they are very pixalated and blurry as they are showing a small image blown up to 100%. I have tried regenerating thumbnails but have had no luck. It is the saem theme with the same code.
My old site image look like this:
Where my new site looks like this:
The images are all in the media library and i I swap them in one by one it wokrs but there are hundreds of posts. Is there a way to get this to work manually somehow? I thought this is what Regenerate Thumbnails was supposed to do. thanks for any help you can give.
I just check and my excerpts are not showing either.
If I understood correctly, you uploaded images via FTP. I assume folder structure is intact - year/month folder structure inside uploads folder. That should work without any other actions. Did you try? I don't understand part where you say "to ensure my image id and such were in the database". If you take your old database and upload to your new server, then why should some ids change? :/
What I want to say is that migrating WP from one host to another is just - copy all files, copy database and that's it. If you are changing domain of the site, then you must search/replace database also (but I don't think that's the case here).

Web Application and Development

i have two pages:
1st page... let it be adminfileupload page
2nd page... home page(this will be site home page)
i have one folder in solution explorer named images.
what i want to do is
adminfileupload has one fileupload control and a button named update
when any one browse image file with file upload and click the button(update) then the image should be viewed in home page and also saved in images folder. each time we chose a file and click the button(update) the image should be changed. and this image should be background image, i mean i also have to show some data from database over that image.
working in c# asp.net
Do you need to keep the other pictures too?
If not, you could just upload a picture give it a fix name, Then in the home page you could just set the background image the path to the picture and the fix name. If you have trouble overloading the picture(does not write over you should delete the picture first).But this is a simple approach and depending on the browser you test on it might keep the first picture in their temp file.
If you want to keep the other images you need to do some extra work and have a storing mechanism that will keep track of your pictures or a dynamic variable that changes the path of the resources. I sugest you take a look at the ASP.NET Personal Web Site Starter Kit It has a mechanism that implement a random picture on the first page but the pages are stored in sql database.
Happy coding
The best way I can think of to do this is on the button upload click event, store the file to the server folder. At the same time assign a Session variable the name of the file uploaded.
You will need to manage file names that get stored on the server or check if they already exist, or if different users upload the same file name, etc.
So Session("myImage") = currFileUploaded
Then do a Redirect back to the current page to show the image, which will link to the session variable that just stored the file name that was uploaded.
You'll need to check for a post back and hide or show the image as necessary.

Can a user select and upload more than one file at a time in asp.net?

I made a website for a friend and he uploads a lot of pictures, around 20k per month. And sadly, I made it so he has to upload 1 at a time, because when they are uploaded they are renamed, attached to a group id and watermarked. Is there a way to allow him to select all 20 in a group and have them be uploaded and processed?
I've looked into a couple of way to do it, mostly flash, and that will not work since we are renaming and added the newly created name to the db.
Adding addition upload controls is not a solution.
If we need to make a desktop application that does the uploading, that is alright as well, but we'd like to keep it all in the asp.net environment.
I have used swfupload for flash-based uploads many times. I don't see why that would stop you from renaming and/or adding the uploaded files to a database, either. Once the file is on the server, you can do anything you like.

wordpress image uploads

I have created my own upload function for forms on my sites frontend. the images upload correctly, but in some cases a blank reference to the image with this as its path: /USR/WWW/USERS//WP-CONTENT/BLOGS.DIR/2/FILES/ occurs in the media library. its seems as though the form uploads images but where there is no image to upload a blank reference is 'uploaded' instead. any ideas of what may be causing this? deleting these empty rows in the db does not affect the site, but seems like bad practice.
I agree with Andrew Bolster, we need a bit more information to help you.
However, based on my own experience, it might be a problem with the filenames themselves. I found WordPress's own function for creating filenames, santize_file_name(), and that saved me a lot of trouble personally.
Check out the details here: http://codex.wordpress.org/Function_Reference/sanitize_file_name

Resources