-
Notifications
You must be signed in to change notification settings - Fork 40
create a backup of the original image #98
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
base: master
Are you sure you want to change the base?
Changes from all commits
4680f5c
e154eb9
f53f00b
ba97e04
3933d3c
c91a855
7ea5ea3
2446827
24c7c0a
435823c
a522659
6882d97
9c5b056
b765371
1d86da6
43991bf
3a863f7
fd2bdc8
295b1dc
45e082e
2dc0ccd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # tiny_image_size_before_compression | ||
|
|
||
| Action that is done before compressing an single image size. | ||
|
|
||
| **Location:** `src/class-tiny-image.php` | ||
| **Since:** 3.7.0 | ||
|
|
||
| ## Arguments | ||
|
|
||
| 1. `int $attachment_id` - The attachment ID. | ||
| 2. `int|string $size_name` - The image size name. 0 for the original. | ||
| 3. `string $filepath` - The file path to the image being compressed. | ||
|
|
||
| ## Example | ||
|
|
||
| ```php | ||
| add_filter( | ||
| 'tiny_image_size_before_compression', | ||
| function ( $attachment_id, $size_name, $filename ) { | ||
| // notify system of compression | ||
| } | ||
| ); | ||
| ``` |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -282,6 +282,14 @@ public function createImage($file_size, $path, $name) | |||||
| ->at($dir); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Creates images on the virtual disk for testing | ||||||
| * @param null|array $sizes Array of size => bytes to create, file will be named $name-$size.png | ||||||
|
||||||
| * @param null|array $sizes Array of size => bytes to create, file will be named $name-$size.png | |
| * @param null|array $sizes Array of size name (array key) => bytes to create; each file will be named "$name-<size name>.png" |
Copilot
AI
Mar 31, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docblock says "@return array object containing metadata", but getTestMetadata() returns a plain array. Consider updating the @return description to avoid confusion for test authors.
| * @return array object containing metadata | |
| * @return array metadata array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docblock for get_preserve_options has an invalid
@paramtag (missing variable name) and the return type description is a bit inconsistent. Use a standard form like "@param string $size_name" and consider "array|false" for the return type to match PHPDoc conventions.