Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Var lagrar WordPress images på din site?

Undrar du var WordPress lagrar images på din website?

Många WordPress Beginnare har frågat oss hur WordPress lagrar images och vad de kan göra för att organisera sitt mediabibliotek mer effektivt.

I den här artikeln förklarar vi hur WordPress lagrar images på din website. Vi kommer också att dela med oss av tools och tillägg som du kan använda för att enkelt organisera dina images mer effektivt.

Where does WordPress store image files (Explained)

Hur lagrar WordPress images?

WordPress har ett built-in system för att hantera mediauppladdare som gillar images, videoklipp, ljud och documents på your WordPress website.

This system allows you to easily upload images and other media to a specific folder on your WordPress hosting server.

Dessa filer visas sedan i ditt mediabibliotek, som du kan view genom att besöka sidan Media ” Library.

WordPress media library

Härifrån kan du editera dessa filer, manipulera dem eller till och med ta bort dem.

Den specifika mappen där image-filerna lagras i WordPress anropas mappen uploads och ligger i mappen /wp-content/.

Uploads folder in WordPress

I den här foldern lagras dina media files i mappar för år och månad. Dessutom ser du mappar som skapats av dina tillägg till WordPress för att saved andra uploads.

For instance, all your media files uploaded in June 2022 will be stored in:

/wp-content/upladdare/2022/06/

Du kan se dessa filer och foldrar genom att ansluta till ditt WordPress webbhotell-konto med en FTP-klient eller via appen File Manager under webbhotell-kontrollpanelen.

Media uploads organized in year and monthly folders

You will notice that there are several copies of each image uploaded on your server.

Dessa bildstorlekar genereras automatiskt av WordPress när du uploadar en image.

Multiple image sizes

Som standard kan du se en thumbnail, medium och stor storlek av imagen tillsammans med den ursprungliga uploaden.

Bortsett från det kan ditt WordPress theme eller tillägg också generera ytterligare image-storlekar för dem att använda.

Nu kanske du undrar hur WordPress visar information om dessa filer i mediabiblioteket.

För att göra detta lagrar WordPress också information om dina uppladdningar av images i databasen som en attachment post type under posts table.

Utöver det sparar WordPress också information i tabellen Metadata för inlägg när du infogar images i inlägg/ pages eller någon annan custom post type.

Meta data for images stored in WordPress database

När du till exempel ställer in en featured image, WordPress saved denna information som en meta-nyckel _thumbnail_id.

Den lagrar sedan den i Metadata för inlägg tabellen i din database.

Image meta data stored in WordPress database

Informationen i din database talar om för WordPress vilken location filen har på ditt webbhotell server.

Om du nu tar bort en fil från din server med FTP, så kommer WordPress att visa dessa images som trasiga.

Broken image in WordPress

På samma sätt, om du delete referensen till en image från din WordPress database, kommer filen fortfarande att vara intakt på din hosting server men ej visas i ditt media bibliotek.

Ändra hur WordPress lagrar Images och mediauppladdningar

Som standard tillåter WordPress inte att du ändrar location för upload från WordPress admin area.

Den enda ändring du kan göra är att inaktivera de månads- och årsbaserade foldrarna genom att besöka Settings ” Media page från WordPress dashboard.

Media settings in WordPress

Härifrån kan du också justera de maximala dimensionerna i pixlar för dina uppladdare av images.

Avancerade WordPress-användare kan följa vår tutorial om hur man manuellt ändrar standard WordPress uploads folder för mer detaljer.

Organisera dina images i WordPress

För de flesta användare fungerar WordPress standard mediabibliotek alldeles utmärkt.

Men om images spelar en viktigare roll i din WordPress blogg, då kan du behöva ytterligare tools för att organisera dina uppladdare.

For instance, if you run a photography website, then you may want to organize your content in Albums or tags.

För det behöver du ett plugin som Envira Gallery. Det är det bästa WordPress-pluginet för bildgallerier på marknaden som allow you att organisera dina images i album, taggar och gallerier.

Envira Gallery provides albums and tags functionality for images

Allowing Users to Upload Images i WordPress

Som standard tillåter WordPress alla användare som kan skriva posts på din website att uploada images. Detta inkluderar användare med användarrollerna Administrator, Author, Editor och Contributor.

Men tänk om du vill att andra användare ska kunna uploada images på din website utan att logga in på admin area?

För att göra det behöver du WPForms plugin. Det är det bästa pluginet för kontaktformulär för WordPress som tillåter dig att enkelt skapa alla typer av formulär för din website.

Den levereras också med ett filuppladdningsfält som gör det möjligt för användare att enkelt ladda upp images, documents och andra filer utan att skapa ett användarkonto eller komma åt WordPress admin area.

Först måste du installera och aktivera WPForms plugin. För mer detaljer, se vår Step-by-Step guide om hur du installerar ett WordPress plugin.

Vid aktivering, besök WPForms ” Settings page för att enter din license key. Du hittar den här informationen under your account på WPForms website.

Entering your WPForms license key

Därefter måste du head till WPForms ” Add New page för att skapa ditt formulär för uppladdning av image.

Ange först en Rubrik för ditt formulär. Efter det kan du leta efter File Upload Form template för att komma igång.

File upload form

WPForms kommer nu att ladda gränssnittet för form builder, där du kommer att se en form preview till höger med formulärfält i den vänstra colonnen.

Denna template innehåller som standard ett fält för upload av filer. You can add or remove fields to your form, change their labels, or move them up or down.

File upload form editing

Du kan klicka på fältet File Upload för att ändra dess Settings. Här kan du ställa in vilka filtyper och hur många filer en användare kan uploada. You kan också ställa in en limit för maximal filstorlek.

Om du vill ha mer detaljer kan du läsa vår tutorial om hur du skapar ett formulär för upload av filer i WordPress.

File upload settings

När du är slutförd kan du save ditt formulär och lämna form buildern.

Nästa måste du skapa ett nytt inlägg eller en page eller editera en befintlig. På vyn post edit, gå vidare och add WPForms block till din content area.

Add form to your WordPress website

Klicka sedan på rullgardinsmenyn i blocket WPForms för att selecta formuläret som du skapade tidigare.

You can now save your changes and preview your post or page to see your file upload form in action.

File upload form

Du kan sedan se alla filer som har laddats upp av användare genom att besöka WPForms ” Entries page från WordPress dashpanelen.

Here, click on your File upload form to view an entry för att se vilka filer som har laddats upp.

User entry

För mer detaljer, se vår kompletta guide om hur du tillåter användare att ladda upp images i WordPress.

Bonus: Optimera WordPress Images för utförd prestanda

Images är mycket engagerande, så de gör ditt content mer intressant för användarna. Men de tar också längre tid att hämta än plain text.

Det innebär att om du har flera stora images på en page, så kommer din webbsida att hämta långsammare. Denna långsamma page speed påverkar både användarnas upplevelse och sökmotorsoptimeringen.

Som tur är finns det massor av tools för att enkelt optimera dina images för webben innan du uppladdar dem till WordPress.

Instance, you can use a WordPress image compression plugin like EWWW Image Optimizer to automatically optimize each image that you upload to your website.

EWWW Image Optimizer

Du kan öka prestandan ytterligare genom att använda ett CDN (content delivery network). This allows you to load images from a global network of servers instead of your hosting server.

Vi rekommenderar att du använder Bunny.net, som är den bästa CDN-tjänsten på marknaden. Det är superenkelt och kommer med ett eget plugin för WordPress för snabbare installation.

Vi hoppas att den här artikeln hjälpte dig att lära dig var WordPress lagrar images på din site. Du kanske också vill se vår guide om hur du hittar royaltyfria images för din WordPress blogg eller se vår Beginner-guide om hur WordPress faktiskt fungerar bakom kulisserna.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

39 kommentarerLämna ett svar

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Mrteesurez says

    Happy to learnt this from your article, all possible possible location where wordpress images are stored. Is it possible to save the images to remote location and serve them inside posts and within website ?

  3. Jiří Vaněk says

    By default, WordPress media is stored in the wp-content/upload folder. Is it possible to change it to another folder in the configuration?

  4. Moinuddin Waheed says

    While we upload any image it gets uploaded inside the media gallery of the wordpress.
    while it gets into different months folders by default it becomes handy to organise and access them but at times it becomes hard to find a particular image if not informed of the month of upload.
    Does images of all kinds whether posts or pages gets into monthly folder or only the posts or articles images go inside monthly folder?

    • WPBeginner Support says

      All of the images should be included in the folders but you should be able to search by title to find the image in your media library.

      Administratör

  5. Omar Abrahim says

    Hi,

    The uploads folder is critical, correct? While there are probably references to the images / files stored in the WP database, the actual files in the uploads folder are needed, as they are not stored in the databse. Do I have that right?

  6. guy says

    hi
    i have about 100 images in my gallery.
    when i looked at the download images in the server, i sow almost 1000.
    same image 10 times.. with different resolution.
    why is that?
    how do wordpress store images?
    thanks

  7. Pratik Patel says

    Hello Admin,

    I have some issues in automated Generated URLs,

    I have some URLs that includes only individual images in body from the rest of the website URLs, and they are indexed in Google. I wanted to remove this type of URLs from the Google Index.

  8. Luis Garcia says

    Hi,

    I have been working in a website. It is a redesign of an already existing page, so what I did was: I exported all posts and pages through WP Exporter, but the images were missing. So, now the posts that had galleries don’t have the galleries, they don’t show up. Later, and as I was really advanced, I realized I should’ve exported and imported the database as well. Long story short, now I am trying to recover those images and make them appear in my current site. Is there a way to blend the last database with the new one?
    Thanks a lot.

  9. Lucy says

    Hi,
    Thanks a lot for your help!!!

    Is there a plugin which can help to remove all the images not actualy used in any posts or pages?

    Thank you.

  10. Nitish says

    Hello
    how to upload user images from custom template to custom folders and also in database table.

    Pls help
    Thanku.

  11. Adam says

    Hello – Are there other places that WP can store images? I’ve taken over a legacy site (a pretty new site) and an image i need to replace is not located in the media library but does not appear to be hosted outside the site.

    • John says

      Hi Adam, did you ever figure this out? I’m running into the same issue. I have a list of images that are too big in file size, so I am going through the site and reducing these to optimize our site upload time. I’m having no luck with finding ANY images that contain ”/legacy” in the URL.

  12. Mahmoud Momani says

    Hello,
    Thanks for the article.
    I have a question about converting an ASP.NET website to wordpress, if you can write an article describing the required tables and how to insert data in it.
    Thanks.

  13. Holly says

    If I delete and image from my media library after posting it to my site will it delete the image off of my site as well?

  14. Ruth Billheimer says

    Am I right in thinking that having a lot of images in the media library doesn’t slow up the site? I’m trying to get my head round the way pages load, to try and get a better speed. So if you have a lot of images on a page, they will slow it up but it doesn’t matter how many images you have stored. Is that right?

  15. nilesh nolkha says

    I had one question regarding SEO of images. When you upload pics in media library, you can suggest a title, caption and alt text. Similarly when you are actually adding that media to the post pr image widget on page builder, you again can enter title, caption, alt image etc. Does it matter if we do it once or we have do it again for the media while adding it to a post ? How it is different

    • Ruth Billheimer says

      I think the caption can vary depending on where you’re using the image but the others stay the same. The alt text should be different from the title, or you can mark the image as decorative. If you have an accessibility plugin for people with a visual impairment, you also have to fill in the description.

  16. Sandy Ellingson says

    Is there a way to export a list of items in the media file with the associated links? I found this post while trying to answer this question. I have looked for the wp_post file via phpmyadmin and can’t find it. Perhaps this is an old post?

  17. Marc Connor says

    Do you guys recommend using your own image folder structure via FTP?

    I like to create a folder in the root called ”images”, and store the images there. Well, as many as that particular WordPress t heme would let me.

    Is that better or worse than the default date-based structure?

    Sincerely,
    Marc

  18. Bob says

    I built a website on my churches server. So now when I’m building my personal site which is a different server. I see all of the media of my churches site with my personal. Oh I built them on my laptop.

  19. jabbo126 says

    It’s shame, that WordPress still haven’t better media files upload solution with better folder organization.

  20. Ikramullah says

    Hi,
    My attached one of images are not shown as image tag beside starting paragraph as a tag.
    How to enable this feature?

    I need this info.

    Thanks.

  21. vijay jangra says

    Hello editorial staff members, i have read and seen your many blog posts. I have a question in mind.
    How to build these beautiful images for your blog posts.

  22. kif says

    hello, can you tell us why wp crop images? even when i upload i single one?

    thank you for your daily edition emails!

    • Kevin says

      WP automatically creates thumbnails, and versions for various sizes (small, medium, large, etc) for use with various devices on responsive website. So generally you’ll have the original size + the various auto-created sizes. You can then pick the appropriate size when adding an image to a page/post and WP will then serve the correct version for the device being used.

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.