-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Hello @getdave,
I'm trying to create a on-demand image resizing with Wordpress and your plugin helps me a lot π .
I can access to URLs like this BASE_URL/app/uploads/2020/02/food-photographer-i-david-fedulov-X92WLoaQ1_o-unsplash.jpg/?width=500&quality=80 with different widths to generate and get different images but changing quality parameter always return the same image.
I think it is because quality parameter is never used in file name creation, so the cached version is returned.
Maybe it should be pushed to $args array here
wp-intervention/src/intervention-wrapper.php
Lines 132 to 149 in b5478fb
| private function set_cache_file_path() { | |
| // Strip PHP callables out of the args | |
| $args = $this->strip_callables( $this->intervention_args ); | |
| // Sort the array by key to ensure consistency of caching filename | |
| ksort( $args ); | |
| $file_pathinfo = pathinfo( $this->src ); | |
| $ext = $file_pathinfo['extension']; | |
| $new_filename = $file_pathinfo['filename'] . '-' . crc32( $this->r_implode( $args, '-' ) ) . '.' . $ext; | |
| // Enable filtering of the filename on a per file basis | |
| $new_filename = apply_filters( 'wpi_cache_file_name', $new_filename, $file_pathinfo['filename'], $ext, $args ); | |
| $this->cache_file_path = WP_Intervention::get_cache_dir() . $new_filename; | |
| } |
Someting like :
$args['quality'] = $this->options['quality'];on line 135.
I can make a PR or add detailed code if you want more infos on my use case.
getdave
Metadata
Metadata
Assignees
Labels
No labels