Skip to content

Commit

Permalink
Polished up the example with better images and explanations
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianboston committed Nov 29, 2021
1 parent 48b6658 commit cecf7f9
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Adrian
Copyright (c) 2021 Adrian Boston

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ The resulting tag is:
<img src="my_image/legacy.jpg" srcset="my_image/320w.jpg 320w, my_image/480w.jpg 480w, my_image/640w.jpg 640w, my_image/768w.jpg 768w, my_image/960w.jpg 960w, my_image/1024w.jpg 1024w, my_image/1280w.jpg 1280w, my_image/1440w.png 1440w" sizes="(min-width: 768px) 50vw, 100vw" alt="A file named my_image">
```

Warnings and erros can be piped into a file to avoid cluttering the console. The most common warning is skipping a file due to its small size less than the `-m` directive.
Warnings and errors can be piped into a file to avoid cluttering the console. The most common warning is skipping a file due to its small size less than the `-m` directive.

srcset examples/simple/test.png 2>srcset.err

Expand Down
21 changes: 21 additions & 0 deletions examples/simple/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

# Simple Example


Convert the provided Library of Congress [Free To Use](https://www.loc.gov/free-to-use/) images using srcset

#### A verbose dry run using the test `-z` directive on an example `tif` image, converting to `jpg` format:

`srcset examples/simple/pnp-bellcm-10100-10106u.tif -t jpg -vz`

#### A verbose dry run using the `-z` directive on the second example `tif` image, converting to `png` format:

`srcset examples/simple/pnp-fsa-8c02000-8c02400u -t png -vz`

#### Convert both images to `jpg` using the recurse `-r` option and dump the images in the `/var/www/images` directory.

```
srcset examples/simple -r -t jpg -o /var/www/images -v
```


Binary file removed examples/simple/Shooting_the_Rapids_1879.jpg
Binary file not shown.
Binary file removed examples/simple/test.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ fn loop_path(dir: &Path, prog_options: &ProgOptions) -> anyhow::Result<()>
{
None => (),
Some("jpg") | Some("JPG") | Some("png") | Some("PNG")
| Some("tiff") | Some("TIFF")
| Some("tiff") | Some("TIFF") | Some("tif") | Some("TIF")
=> {
if path.metadata()?.len() > prog_options.min_size
{
Expand Down

0 comments on commit cecf7f9

Please sign in to comment.