mirror of
https://gitlab.com/upRootNutrition/website.git
synced 2025-06-16 04:25:11 -05:00
feat: added two articles
This commit is contained in:
parent
3a22edfad4
commit
4bddff2911
233 changed files with 7050 additions and 4 deletions
34
frontend/scripts/imagedownloader.sh
Executable file
34
frontend/scripts/imagedownloader.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 <website_url>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create a directory to store images
|
||||
mkdir -p downloaded_images
|
||||
cd downloaded_images
|
||||
|
||||
# Counter for image naming, start at 1
|
||||
counter=1
|
||||
|
||||
# Extract image URLs and download
|
||||
wget -q -O- "$1" | grep -oE 'https?://[^"]+\.(jpg|jpeg|png|gif)' | while read -r img_url; do
|
||||
# Download image
|
||||
wget -q "$img_url" -O "temp_image"
|
||||
|
||||
# Get image width using file size and basic check (approximate)
|
||||
width=$(file "temp_image" | grep -oE '[0-9]+ x [0-9]+' | cut -d' ' -f1)
|
||||
|
||||
# Check if width is over 400
|
||||
if [ -n "$width" ] && [ "$width" -gt 400 ]; then
|
||||
# Rename to sequential PNG starting from image1.png
|
||||
mv "temp_image" "image$counter.png"
|
||||
((counter++))
|
||||
else
|
||||
# Remove images that don't meet criteria
|
||||
rm "temp_image"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Downloaded $((counter-1)) images larger than 400px wide"
|
Loading…
Add table
Add a link
Reference in a new issue