Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .gitattributes

This file was deleted.

47 changes: 0 additions & 47 deletions .gitignore

This file was deleted.

33 changes: 13 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
#Database Quotes JSON
##JSON file with more than 5000+ famous quotes.
# Database-Quotes-JSON
JSON file with more than 5000+ famous quotes. (quotes.json)

###Some example on how to work on this JSON quotes file
Quotations ( Text ---> image )
-The text is converted to an image

```javascript
//return array of all quotes with 12 words max
var filePath = "quotes.js";
$.getJSON(filePath).done(function (data) {
return data.filter(function (o) {
return o.quoteText.split(" ").length <= 12;
});
});
(quotes.json "text" , bg.png "background image",font Roboto-Black.ttf "font") → quotes (image)

Installation
---------
$ pip install nider 👍
$ python3 img_return.py 👍

- https://www.facebook.com/Quotation.ToD


//return array of all quotes of Buddha
var filePath = "quotes.js";
$.getJSON(filePath).done(function (data) {
return data.filter(function (o) {
return o.quoteAuthor === "Buddha";
});
});
}
```
Binary file added Roboto-Black.ttf
Binary file not shown.
Binary file added bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions img_return.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from nider.core import Font
from nider.core import Outline
from nider.models import Content
from nider.models import Linkback
from nider.models import Paragraph
from nider.models import Image
import json

f = open("quotes.json", "r")
File_json = json.load(f, encoding='ISO 8859-1')
roboto_font_folder = '/home/ziad/Desktop/Console_Posts/Posts/'
text_outline = Outline(2, '#121212')

def img_to_txt(txt,author,result):
para = Paragraph(text=txt,
font=Font(roboto_font_folder + 'Roboto-Black.ttf',30),
text_width=30,
align='center',
color='#ededed',
outline=text_outline
)
linkback = Linkback(text=author,
font=Font(roboto_font_folder + 'Roboto-Black.ttf',30),
color='#ededed',
outline=text_outline
)
content = Content(paragraph=para, linkback=linkback)
img = Image(content,
fullpath=result,
width=3000,
height=2005
)
img.draw_on_image('bg.png')
def quote_Text(counter):
global File_json
quoteText = File_json[counter]['quoteText']
return quoteText
def quote_Author(counter):
global File_json
quoteAuthor = "-" + File_json[counter]['quoteAuthor']
return quoteAuthor
for counter in range(550):
result = str(counter) + ".png"
img_to_txt(quote_Text(counter),quote_Author(counter),result)