diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cab..0000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore deleted file mode 100644 index cd2946a..0000000 --- a/.gitignore +++ /dev/null @@ -1,47 +0,0 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk diff --git a/README.md b/README.md index 3594fa1..289d1b5 100644 --- a/README.md +++ b/README.md @@ -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"; - }); - }); -} -``` \ No newline at end of file diff --git a/Roboto-Black.ttf b/Roboto-Black.ttf new file mode 100644 index 0000000..86ec2b2 Binary files /dev/null and b/Roboto-Black.ttf differ diff --git a/bg.png b/bg.png new file mode 100644 index 0000000..42cd432 Binary files /dev/null and b/bg.png differ diff --git a/img_return.py b/img_return.py new file mode 100644 index 0000000..f658a52 --- /dev/null +++ b/img_return.py @@ -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)