Add teachers photos

This commit is contained in:
VityaSchel
2023-10-01 23:04:01 +04:00
parent 6653796e87
commit de4208337e
64 changed files with 745 additions and 44 deletions

View File

@@ -0,0 +1,2 @@
sources/*
sources/urls.txt

View File

@@ -0,0 +1,47 @@
import fs from 'fs/promises'
import path from 'path'
import sharp from 'sharp'
import { dirname } from 'path'
import { fileURLToPath } from 'url'
const __dirname = dirname(fileURLToPath(import.meta.url)) + '/'
async function cropImages(imagePaths) {
try {
await fs.mkdir(__dirname + '../cropped')
} catch (err) {
if (err.code !== 'EEXIST') {
console.error('Failed to create directory:', err)
return
}
}
for (const imagePath of imagePaths) {
const imageFileName = path.basename(imagePath)
const outputFileName = `${__dirname}../cropped/${imageFileName}`
try {
const image = sharp(imagePath)
const metadata = await image.metadata()
const minDimension = Math.min(metadata.width, metadata.height)
await image
.extract({ left: 0, top: 0, width: minDimension, height: minDimension })
.resize(96, 96, { fit: 'contain' })
.toFile(outputFileName)
console.log(`Successfully cropped ${imageFileName}`)
} catch (err) {
console.error(`Failed to crop ${imageFileName}:`, err)
}
}
}
const files = await fs.readdir(__dirname + '../sources')
const imagePaths = files
.filter(f => f.toLowerCase().endsWith('.jpg') || f.toLowerCase().endsWith('.png'))
.map(f => __dirname + '../sources/' + f)
await cropImages(imagePaths)

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env zsh
# Read each line from urls.txt
while IFS= read -r url; do
# Extract file name from URL
filename=$(basename $url)
# Download the content to a temporary file
temp_file=$(mktemp)
curl -s -o $temp_file $url
# Check if download was successful
if [[ $? -eq 0 ]]; then
# Use 'file --mime-type' to determine the mime type of the file
content_type=$(file --mime-type -b $temp_file)
# Check if the content type starts with 'image'
if [[ $content_type == image/* ]]; then
echo "$filename downloaded successfully."
mv $temp_file $filename
else
echo "Skipping $filename (Content type is not image)."
rm -f $temp_file
fi
else
echo "Failed to download $filename."
fi
done < urls.txt

View File

@@ -0,0 +1,16 @@
import fs from 'fs/promises'
import { dirname } from 'path'
import { fileURLToPath } from 'url'
const __dirname = dirname(fileURLToPath(import.meta.url)) + '/'
const files = await fs.readdir(__dirname + '../sources')
const images = files
.filter(f => f.toLowerCase().endsWith('.jpg') || f.toLowerCase().endsWith('.png'))
.filter(f => f.startsWith('%'))
for(const image of images) {
console.log(image, '->', decodeURIComponent(image))
await fs.rename(__dirname + '../sources/' + image, __dirname + '../sources/' + decodeURIComponent(image))
}

247
src/shared/data/teachers.ts Normal file
View File

@@ -0,0 +1,247 @@
// https://gist.github.com/VityaSchel/28f1a360ee7798511765910b39c6086c
export const teachers = [
{
'name': 'Абалымова Людмила Павловна',
'picture': 'https://ks.psuti.ru/images/stories/emp/abalimova-l-.jpg'
},
{
'name': 'Абрамова Светлана Геннадьевна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/qwefdsfsd.jpg'
},
{
'name': 'Алехин Иван Николаевич',
'picture': 'https://ks.psuti.ru/images/stories/emp/alehin-i-n.jpg'
},
{
'name': 'Амукова Светлана Николаевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/'
},
{
'name': 'Андреева Елена Сергеевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/-i-n.jpg'
},
{
'name': 'Андреевская Наталья Владимировна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2021/IMG_5419.jpg'
},
{
'name': 'Андрющенко Анна Вячеславовна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/andriushenko.jpg'
},
{
'name': 'Арефьев Андрей Андреевич',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/%20class='
},
{
'name': 'Бондаренко Анастасия Вячеславовна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/9GLhbTgCmhk.jpg'
},
{
'name': 'Горшенина Ольга Николаевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/gorwenina-o-n.jpg'
},
{
'name': 'Дмитриева Наталья Владимировна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/dmitrieva-n-v.jpg'
},
{
'name': 'Елисеева Эмиля Владиславовна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/9GLhbTgC.jpg'
},
{
'name': 'Ермолаева Галина Владимировна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/ermolaeva-g-v.jpg'
},
{
'name': 'Жабборова Светлана Сергеевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/tryaskina-s-s.jpg'
},
{
'name': 'Жилина Елена Николаевна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/jilina.jpg'
},
{
'name': 'Иванова Мария Сергеевна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/konovalova.jpg'
},
{
'name': 'Карпеева Александра Сергеевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/2014-karpeeva-a-s.jpg'
},
{
'name': 'Карпова Ирина Васильевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/karpova-i-v.jpg'
},
{
'name': 'Козько Диана Игоревна',
'picture': 'https://ks.psuti.ru/images/stories/emp/kozko-d-i.jpg'
},
{
'name': 'Корнилова Светлана Александровна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/kornilova-s-a.jpg'
},
{
'name': 'Краюшкина Ольга Борисовна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/fsdadsd.jpg'
},
{
'name': 'Крынкина Анна Андреевна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/%D0%A7%D0%B0%D0%B4%D0%B5%D0%BD%D0%BA%D0%BE%D0%B2%D0%B0%20DSC06721.JPG'
},
{
'name': 'Кукарская Людмила Петровна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/kukarskaya-l-p.jpg'
},
{
'name': 'Кусаева Зарина Владимировна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2022/%D0%B0%D0%B2%D0%BF%D0%BA%D1%83%D0%BF%D1%8B%D0%BF.jpg'
},
{
'name': 'Ларионова Софья Николаевна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/.jpg'
},
{
'name': 'Лизунова Елена Владимировна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/lizunova.jpg'
},
{
'name': 'Лобачева Милана Евгеньевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/lobacheva-m-e.jpg'
},
{
'name': 'Логвинов Александр Владимирович',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/logvinov_a_v.jpg'
},
{
'name': 'Малбасарова Галия Худанбаевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/2014-kuntaeva.jpg'
},
{
'name': 'Матулина Татьяна Сергеевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/matulina.jpg'
},
{
'name': 'Михалькова Ирина Евгеньевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/2019-mihalkova.jpg'
},
{
'name': 'Назарова Елена Федоровна',
'picture': 'https://ks.psuti.ru/images/stories/emp/nazarova.jpg'
},
{
'name': 'Негина Айгуль Зинуловна',
'picture': 'https://ks.psuti.ru/images/stories/emp/2014-aitasova-a-z.jpg'
},
{
'name': 'Некрылова Татьяна Борисовна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/nekrylova-t-b.jpg'
},
{
'name': 'Никифоров Михаил Михайлович',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/nikiforov-m-m.jpg'
},
{
'name': 'Першина Елена Викторовна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/pershina-e-v.jpg'
},
{
'name': 'Потяйкин Роман Владимирович',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/.jpg'
},
{
'name': 'Рзаева Алина Игоревна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/DSC06789.JPG'
},
{
'name': 'Савич Мария Владимировна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/asdasad.jpg'
},
{
'name': 'Самойлова Наталья Николаевна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2022/samoylova.jpg'
},
{
'name': 'Семенов Антон Сергеевич',
'picture': 'https://ks.psuti.ru/images/stories/emp/antonov-a-s.jpg'
},
{
'name': 'Сергеев Роман Алексеевич',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/.jpg'
},
{
'name': 'Сиднина Юлия Валерьевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/%D1%81%D0%B8%D0%B4%D0%BD%D0%B8%D0%BD%D0%B0.jpg'
},
{
'name': 'Синекопова Лариса Владимировна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/sinekopova-l-v.jpg'
},
{
'name': 'Сироткина Ольга Владимировна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/sirotkina-o-v.jpg'
},
{
'name': 'Ситникова Людмила Геннадьевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/sitnikova-l-.jpg'
},
{
'name': 'Славкина Татьяна Анатольевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/slavkina-t-a.jpg'
},
{
'name': 'Сорокина Надежда Леонидовна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/sorokina-n.jpg'
},
{
'name': 'Странник Дмитрий Христианович',
'picture': 'https://ks.psuti.ru/images/stories/emp/stranik.jpg'
},
{
'name': 'Тананыхина Надежда Воалимировна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/IMG-f8eeb02.jpg'
},
{
'name': 'Терёхин Дмитрий Вячеславович',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/terexin.jpg'
},
{
'name': 'Упанова Анастасия Владимировна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/.jpg'
},
{
'name': 'Утыбаева Светлана Михайловна',
'picture': 'https://ks.psuti.ru/images/stories/emp/2019-utibaeva-s-m.jpg'
},
{
'name': 'Федотова Елена Дмитриевна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/fedotova-e-.jpg'
},
{
'name': 'Фомин Александр Васильевич',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/fomin-a-v.jpg'
},
{
'name': 'Ходотова Евгения Андреевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/hodotova.jpg'
},
{
'name': 'Черненкова Наталья Владимировна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/chernenkova-n-v.jpg'
},
{
'name': 'Шамбер Лола Низамовна',
'picture': 'https://ks.psuti.ru/images/stories/emp/shamber-l-n.jpg'
},
{
'name': 'Шомас Елена Александровна',
'picture': 'https://ks.psuti.ru/images/stories/emp/2014-shomas.jpg'
},
{
'name': 'Шукова Марина Геннадьевна',
'picture': 'https://ks.psuti.ru/images/stories/emp/new/shykova.jpg'
},
{
'name': 'Щербакова Надежда Юрьевна',
'picture': 'https://ks.psuti.ru/images/stories/ks-news/2016/prepodavateli-foto/andreeva.jpg'
}
]