Git Product home page Git Product logo

Comments (21)

timmyomahony avatar timmyomahony commented on May 25, 2024 5

I've added this feature now to develop but will need to do some testing before creating a release.

The original PR (2015?) from this thread was very useful but it made a lot of changes to the code, including removing the submodules and hard-coding the pagedown library. Furthermore it relied on an ajax file upload external library as well as jQuery UI.

I've taken this PR and stripped it back to add basic image upload functionality.

image-upload

from django-pagedown.

ialbert avatar ialbert commented on May 25, 2024 2

A few comments on the handling of the file server-side, I would recommend delegating that job to a django ImageField as shown here:

https://docs.djangoproject.com/en/3.0/ref/forms/fields/#django.forms.ImageField

and here:

https://docs.djangoproject.com/en/3.0/topics/http/file-uploads/

this will add the pillow dependency though, but that is not a particular burden. It will detect file types and deals with many other potential security issues. That being said if the javascript part of the upload works with the current setup we can refactor the Python code and make a pull request as long as you would entertain that idea..

from django-pagedown.

wuhfen avatar wuhfen commented on May 25, 2024 1

+1

from django-pagedown.

gurugeek avatar gurugeek commented on May 25, 2024 1

@timmyomahony thanks a lot. Optional via setting would be fine too. Would be happy to make a small donation if it helps to free some of your time.

from django-pagedown.

timmyomahony avatar timmyomahony commented on May 25, 2024

Not at the moment unfortunately. It's something I want to add and there has been a pull request with an approach but I haven't had time to review it or implement it yet.

from django-pagedown.

Archao-ME avatar Archao-ME commented on May 25, 2024

django-pagedown is very useful for me . Now i need a way to upload image and insert it into my markdown . i have no idea to solved this problem.do you have any solution to solve it ? THX

from django-pagedown.

sai-prasanna avatar sai-prasanna commented on May 25, 2024

I gave a pull request for image upload functionality , see that..

from django-pagedown.

iho avatar iho commented on May 25, 2024

+1

from django-pagedown.

xie186 avatar xie186 commented on May 25, 2024

+1

from django-pagedown.

gurugeek avatar gurugeek commented on May 25, 2024

any way to speed up image upload functionality? Perhaps with a donation in order to buy time for this add-on ? it would be very useful.

from django-pagedown.

timmyomahony avatar timmyomahony commented on May 25, 2024

Hi @gurugeek I'm going to have a look at adding this. The reason I haven't added it to date is that it's not a part of the editor. I should be able to add it though without hugely affecting the default experience. Maybe it could be enabled as an optional feature via a setting

from django-pagedown.

gurugeek avatar gurugeek commented on May 25, 2024

@timmyomahony thanks a lot for working on this. I will test it too!

from django-pagedown.

timmyomahony avatar timmyomahony commented on May 25, 2024

Hi @ialbert, happy to use forms + imagefield + native validation if you have a PR. I don't think the JS would need to change? We'd just need a form that has a file = ImageField(...).

from django-pagedown.

piggybit avatar piggybit commented on May 25, 2024

@timmyomahony i am not sure if @ialbert will refactor the code with Python or we currently stick with your recent dev version?

from django-pagedown.

jaradc avatar jaradc commented on May 25, 2024

How do I install the develop branch version with pip? Is the pip command the same?

from django-pagedown.

gurugeek avatar gurugeek commented on May 25, 2024

any chance to add some easy instructions for pip install ?

from django-pagedown.

gurugeek avatar gurugeek commented on May 25, 2024

I did manage to install with pip3

ids-MacBook-Pro david_dev_django % pip3 install https://github.com/timmyomahony/django-pagedown/archive/develop.zip
Collecting https://github.com/timmyomahony/django-pagedown/archive/develop.zip
Using cached https://github.com/timmyomahony/django-pagedown/archive/develop.zip
Requirement already satisfied: Django>=2.1 in /usr/local/lib/python3.7/site-packages (from django-pagedown==2.0.3) (3.0.2)
Requirement already satisfied: pytz in /usr/local/lib/python3.7/site-packages (from Django>=2.1->django-pagedown==2.0.3) (2018.9)
Requirement already satisfied: sqlparse>=0.2.2 in /usr/local/lib/python3.7/site-packages (from Django>=2.1->django-pagedown==2.0.3) (0.2.4)
Requirement already satisfied: asgiref~=3.2 in /usr/local/lib/python3.7/site-packages (from Django>=2.1->django-pagedown==2.0.3) (3.2.3)
Building wheels for collected packages: django-pagedown
Building wheel for django-pagedown (setup.py) ... done
Created wheel for django-pagedown: filename=django_pagedown-2.0.3-py3-none-any.whl size=10122 sha256=35f74d4ce8e2f7816c0f232b106ec71ef5de3acf1e72dcecf5c2894c53b5809f
Stored in directory: /private/var/folders/w4/tqwp2zcd3r7_p4nflvl0mkth0000gn/T/pip-ephem-wheel-cache-2cjuyq7g/wheels/1e/0f/ec/fa477da3e48a074a16da13e12ab59ff6cb4afdadbe9e8fcc79
Successfully built django-pagedown
Installing collected packages: django-pagedown
Successfully installed django-pagedown-2.0.3
gurugeek@Davids-MacBook-Pro david_dev_django % python3 manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

but unfortunately it still shows no option for the image upload? :(

from django-pagedown.

jaradc avatar jaradc commented on May 25, 2024

It's in the "develop" branch, not the master.
select-develop-branch

I pip installed the develop branch version with this:

pip install -e git+https://github.com/timmyomahony/django-pagedown.git@develop#egg=django-pagedown

from django-pagedown.

timmyomahony avatar timmyomahony commented on May 25, 2024

Sorry, I haven't had a chance to sit down and review this before pulling it into master so it's still just a feature in develop. I'm going to try get to this ASAP

from django-pagedown.

ashwani99 avatar ashwani99 commented on May 25, 2024

Hey @timmyomahony Thanks for the feature, much needed!

Is this feature implementation mature enough to be used? I mean I could pull it from the develop branch but I not sure if I can use it in production?

from django-pagedown.

timmyomahony avatar timmyomahony commented on May 25, 2024

I've modified the image upload functionality to use ImageField now and I've pulled the changes into version 2.1.1. Please try it out and let me know if there are any issues.

from django-pagedown.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.