Personal Website with Django how to deal with images scaling/cropping

To be honest not much, I simply followed some tutorials online and step by step came my goal cloaser … I would really say I’m only a beginner. But back at my old work I worked with Umbraco and Model View Controller, some I have kind of an understanding … I mostly do fron development but I try to learn as much as i can and therefore I try also a bit backend… :slight_smile:
Kind eregards, and thank you for posting,
Daniel

I FINALLY DID IT. Firstly I had to migare and makemigrations to my website, and the secondly REALLY IMPORTANTLY restart my docker django container … After I had done this things work. Even the Images work with the code that you have me provided! Thank you so much you saved my day/night :smiley:

I’ll keep in touch if I encounter further problems!! :slight_smile: Kind regards, Daniel

1 Like

One more thing. I previously used all the time postgresql and no matter what I tried to change in the code I got so often database errrors… Now I quickly switched to sqlite3 and no problems so far. Knock on wood. How bad would it be if i Used sqlite3 in production for a small website, can I feel it that it runs slower or are better database only for have load designed? I create only a portofolio website about myself and therefore no heavy computing is needed… Whats your opinion on that?

I noticed when I upload images I can access them via title, but I have always to use .png or .jpg as ending… Is there a smart solution to around for this problem? Maybe I’m a bit nerdy asking for it, but as after now I came so far that I feel a bit proud I must say :slight_smile:

I’m not following what you’re asking about here. Can you provide more context about the situation?

<img src="/media/appetizer/github">

My code look like this, but I always have manually add png or jpg … or is it valid html if I doesn’t use that? I think not or?

Continuing the discussion from Personal Website with Django how to deal with images scaling/cropping:

<img src="/media/appetizer/github">

My code look like this, but I always have manually add png or jpg … or is it valid html if I doesn’t use that? I think not or?

As I thinking right now, I guess I call the images not the right way via the title. If I did it via the title it should automatically add the correct ending, am I right in this case?

        <h1 style="background-color: red">{{ Images.title }}</h1>
        <h1 style="background-color: red">{{ Images.name_field }}</h1>
        <h1 style="background-color: red">{{ Images.data_field }}</h1>
        <br><br><br><br>
        <img src="{{ Images.image_field.url }}" alt="test">
        <img src="/media/appetizer/github.png" alt="Company Logo">

Managed all properties which I created in the cms to give the out in the template!
Thanks again a lot for the help and insipiration of you guys! Thank you! :slight_smile: