Skip to content

Commit

Permalink
Get bio pics working
Browse files Browse the repository at this point in the history
  • Loading branch information
em843 committed May 7, 2024
1 parent 67ae137 commit 13759da
Show file tree
Hide file tree
Showing 33 changed files with 98 additions and 30 deletions.
36 changes: 36 additions & 0 deletions scripts/write_form_data_to_dict.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import pandas as pd


Expand All @@ -20,6 +21,39 @@ def convert_drive_link_to_direct_image_url(link):
return f"{prefix}{file_id}"


def clean_name(first_name, last_name):
# Define titles to remove
titles = ["Dr.", "Mr.", "Ms.", "Mrs."]
first_name = first_name.strip()
last_name = last_name.strip()

# Remove titles and extra spaces
for title in titles:
if first_name.startswith(title):
first_name = first_name[len(title) :].strip()


def update_image_field(people, headshots_directory):
# Update 'image' field by searching in the specified directory
updated_people = []
for person in people:
print(person["name"])
# Search for matching files
matched_files = [
f for f in os.listdir(headshots_directory) if person["name"] in f
]
if matched_files:
# Update the image field with the first match found
print(f"Match files: {matched_files}")
person["image"] = os.path.join(headshots_directory, matched_files[0])
else:
person["image"] = None
updated_people.append(person)

# Return the updated list of dictionaries
return updated_people


# Load the CSV file into a DataFrame
df = pd.read_csv("./contributor_info_responses_5_6_24.csv")

Expand Down Expand Up @@ -128,6 +162,8 @@ def convert_drive_link_to_direct_image_url(link):
axis=1,
).tolist()

people = update_image_field(people, "../website/src/assets/headshots")

# Print new content of bios.const.ts to terminal (content of file can be replaced)
print("import { Person } from '../types/Person.type'\nexport const people: Person[] =[")
for p in people:
Expand Down
2 changes: 1 addition & 1 deletion website/src/app/components/bio-card/bio-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { Person } from "src/app/types/Person.type";

handleImageError(event: any) {
console.log('Failed to load image', event);
event.target.src = '../../../assets/headshots/default_headshot.jpeg';
event.target.src = '../../../assets/default_headshot.jpeg';
}


Expand Down
32 changes: 32 additions & 0 deletions website/src/app/consts/bios-copy.const.ts

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions website/src/app/consts/bios.const.ts

Large diffs are not rendered by default.

File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/src/assets/headshots/Carnell Zhou.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/src/assets/headshots/me - Hansal Shah.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 13759da

Please sign in to comment.