Skip to content Skip to sidebar Skip to footer

Trying To Display The Image That Got Extracted From The User Posted Link

This is what I'm trying to do. Let user post url, the url is submitted and extract main image from the link user posted. Display that image. I;m at a point the image got extracted

Solution 1:

I don't see your models.py file. So I would do this:

  1. Make sure, that you have in your models.py in your class a "column" e.g.

    img = models.FileField(upload_to='static/your_directory/', null=True)

    Without "null=True" Django cannot make migrations.

  2. After submitting Django will place that image into mentioned directory.

  3. Render image in your template after setting context data:

    <img src="/{{ your_object.img }}"> !!! do NOT forget the SLASH !!!

This is a setup without AJAX. Please read comments below for futher information, thx.

Post a Comment for "Trying To Display The Image That Got Extracted From The User Posted Link"