Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: author profile images #38

Open
LeCodeurSpatial opened this issue Dec 18, 2020 · 13 comments
Open

feature: author profile images #38

LeCodeurSpatial opened this issue Dec 18, 2020 · 13 comments
Labels
💡 type: feature An issue or pull request relating a new feature

Comments

@LeCodeurSpatial
Copy link

Author Image Feature

Feature Request

  • To add author_image field or author_image_link field.

This update will look to add another feature in feature-rich Quote API.
It would be amazing to have the author's image along with the quote and bio.

@lukePeavey lukePeavey changed the title (Feature Request) Author Image [Feature Request] Author Images Dec 20, 2020
@lukePeavey lukePeavey added the 💡 type: feature An issue or pull request relating a new feature label Dec 20, 2020
@lukePeavey
Copy link
Owner

Sorry about the delay...

I have profile images for all of the current authors now (720). I think it makes sense to host the images ourselves, rather than using a third party (like wikipedia).

What size images do you think would be ideal? The actual size of the images varies. The smallest are around 200px, most are >= 600px. One possibility would be to generate two image sizes, a thumbnail (ie 200px) and a full size image when possible.

{ 
  // Url to thumbnail 
  thumbnail: string
  // URL of larger image
  image?: string
}

Also, do you have any thoughts on a good place to manage the image library that would allow other people to view and contribute to it? For now, I put them up on Google Photos so you can check out what we have so far. The file names are the author names.

Google Photos Album

@LeCodeurSpatial
Copy link
Author

No worries!

Great Job collecting 720 images, must have been tedious.
I tried collecting a few earlier last weekend and only finished with alphabet 'A'. I had a grayscale theme in mind as well, took some time getting them and editing handful.

I looked at your image collection, went through some. Having a custom library like what you have done with Google Albums is a way better idea for the project than a third party one. But, will have to convert tiff images to jpeg or another compression format as it will take high time to load.

Pinterest seems great to maintain an image library and contributing will be easier as well. I don't currently know a better site.
This is what I have created so far. Pinterest Authors Board

Images below 600px would be inadequate these days, however, is workable if no other choice.
It would be great if we scale an image to a particular size and ratio, maybe even a couple of filters and present as follows:

{ 
  // Url to orignal image
  image: string
  // URL of larger image
  image_big: string
  // URL to 1:1 image
  image_square: string
  //URL to grayscale
 image_bw: string
}

Only if, it is feasible through javascript. Maintaining each separately will be dreary.

I believe I have a way to get it done, will try it this weekend.

@lukePeavey
Copy link
Owner

Quick update...
I went through the photos again and replaced most of the smaller images. So all of the original images are now > 700px wide.

We can use sharp to automate image resizing/processing. I like your idea of using grayscale for all the profile images. A lot of the author images are already in black and white, so I think it feels more consistent to have them all black and white.

Here is an updated version of the image collection with all images converted to grayscale, cropped to a 1:1 aspect ratio, and resized to 700px.

Author Profile Images

@lukePeavey
Copy link
Owner

I am going to setup an image hosting server on AWS.

My plan is:

  1. Setup an S3 bucket to store the original (un-modified) images.
  2. Setup a Serverless function (AWS Lambda) that automatically generates all the required image sizes every time a photo is added or modified in the original images bucket; then saves the resized images to a separate bucket using a specific naming convention, (ie original-image-name--{width}-x-{height}.jpg).
  3. Setup an image server using AWS Lambda and API gateway that serves the images.

Anyway, just wanted to post a quick update before I head to work. I am going to work more on this next weekend.

@dippas
Copy link
Contributor

dippas commented Feb 27, 2021

@lukePeavey at this point how can I get the image/thumbnail from the author, you said you already did that but I can't find the image/property when GET /quotes or even GET /random, am I missing something obvious? Thanks :)

@lukePeavey
Copy link
Owner

lukePeavey commented Feb 27, 2021

@dippas

This feature has not been added yet. I have profile images for all of the authors. But I still need to set up some type of image hosting. Once that is ready, we will add an image field (or something like that) to the authors.

As soon as I have a block of free time to work on it, I will try to get this done.

@dippas
Copy link
Contributor

dippas commented Feb 27, 2021

@lukePeavey thanks, I am using (at the moment) the wikipedia API to get the image of the author (if exists).

I'll be waiting then :)

@lukePeavey
Copy link
Owner

Hi everyone, I apologize for the holdup on the author images feature. Work has been very busy lately so I haven't had a lot of time to work on this 😞

@dippas
Copy link
Contributor

dippas commented Feb 27, 2021

@lukePeavey can you give a roughly estimate when you'll have this done?

@lukePeavey
Copy link
Owner

@dippas Hopefully within the next month.

@lukePeavey
Copy link
Owner

lukePeavey commented Mar 2, 2021

Temporary Solution

For anyone who wants to start using the images feature right away, here an initial version. The final API for images will probably be a bit different, but this approach will continue to work in the future as well, so it's safe to use.

URLs for author profile images can be constructed in the following way. All images are JPEG format with a .jpg extension. All authors should have a profile image. If you find any broken/missing images, you can report them here (#52).

Profile Image URLs

`${BASE_URL}/${size}/${slug}.jpg`

BASE_URL

https://images.quotable.dev/profile

size

The image size in pixels. All images are 1:1 aspect ratio.

Supported values: 200 | 400 | 700

slug

The author slug is a URL safe version of the author's name. This property can be found on the author objects returned by the author endpoints (/authors/:id or /authors).

{
  "link": "https://en.wikipedia.org/wiki/A._P._J._Abdul_Kalam",
  "bio": "Avul Pakir Jainulabdeen Abdul Kalam (15 October 1931 – 27 July 2015) was an aerospace scientist who served as the 11th President of India from 2002 to 2007.",
  "_id": "Bblz8Knp6-ZB",
  "name": "A. P. J. Abdul Kalam",
  "quoteCount": 2,
  "slug": "a-p-j-abdul-kalam"
 },

This was thrown together fairly quickly, so there may be some bugs/issues. I am going to leave this issue open while we continue to work on this.

@lukePeavey
Copy link
Owner

Here is an updated example

Screen Shot 2021-03-22 at 4 05 59 AM

Edit Quotable Author Profile Images

Planning to work on this feature next week. So should have an update soon.

@lukePeavey lukePeavey changed the title [Feature Request] Author Images feature: author profile images Jul 15, 2021
@lukePeavey
Copy link
Owner

Fixed all broken/missing images. Every author now has a profile image.

Screen Shot 2021-10-17 at 1 47 57 AM

Edit Quotable Author Profile Images (forked)

If you would like to submit a different profile image for any of the authors, post a comment on #52 with the author name and the new image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 type: feature An issue or pull request relating a new feature
Projects
None yet
Development

No branches or pull requests

3 participants