conversion ignores videos
This commit is contained in:
parent
d4da28e4f9
commit
8347ad2314
@ -76,11 +76,17 @@ log_change() {
|
|||||||
# Function to handle errors and convert images to JPEG using ImageMagick
|
# Function to handle errors and convert images to JPEG using ImageMagick
|
||||||
handle_conversion_error() {
|
handle_conversion_error() {
|
||||||
photo="$1"
|
photo="$1"
|
||||||
|
file_type=$(file --mime-type -b "$photo")
|
||||||
|
|
||||||
|
if [[ $file_type == image/* ]]; then
|
||||||
new_photo="${photo%.*}.jpg"
|
new_photo="${photo%.*}.jpg"
|
||||||
echo "Converting $photo to $new_photo using ImageMagick."
|
echo "Converting $photo to $new_photo using ImageMagick."
|
||||||
mogrify -format jpg "$photo"
|
mogrify -format jpg "$photo"
|
||||||
mv "${photo%.*}.jpg" "$new_photo"
|
mv "${photo%.*}.jpg" "$new_photo"
|
||||||
rm "$photo"
|
rm "$photo"
|
||||||
|
else
|
||||||
|
echo "File is a video or unsupported type: $photo. Skipping conversion."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Loop through each year directory
|
# Loop through each year directory
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user