Skip to content

boards/update-thumb.sh: Create thumbnails for JPG and PNG images. #91

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

Merged
merged 1 commit into from
Apr 26, 2025

Conversation

dpgeorge
Copy link
Member

No description provided.

@dpgeorge dpgeorge requested a review from mattytrentini April 23, 2025 03:31
Copy link
Contributor

@mattytrentini mattytrentini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was originally thinking:

rm */*.thumb.jpg */*.thumb.png
for file in */*; do
    if [[ $file == *.jpg || $file == *.png ]]; then
        ext=${file##*.}
        convert "$file" -thumbnail 300 "${file%.$ext}.thumb.$ext"
    fi
done

But the function approach works just as well!

The only minor concern is that rm will produce an error if the directory doesn't contain either *.thumb.png or *.thumb.jpg. Might be a problem the first time it's run?

@dpgeorge
Copy link
Member Author

The only minor concern is that rm will produce an error if the directory doesn't contain either *.thumb.png or *.thumb.jpg. Might be a problem the first time it's run?

Right, it does produce an error but the function continues to run and generate the thumbs. I think that's fine, this doesn't need to be a user friendly script so much.

@dpgeorge dpgeorge merged commit fbb20ad into main Apr 26, 2025
@dpgeorge dpgeorge deleted the update-thumb-support-png branch April 26, 2025 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants