Improvement of URL matching
-
So I got multiple errors from ImageUploader::getFilename()
Some URL, like
https://lh3.googleusercontent.com/nFZVza6phshhw7VJ7-h2WP5Rrw1ASB1RV27pCDNXQYoIqmK-3pfL7BMCuQZ8mqfYf32ywCebbZdrtGCPHMOX6r1ZGy-_yPzcUkzykwYRqwA09cwLRfoxDJmaprQJyK6IUgWuYwuM
do not work with the functionI propose an improvement :
/** * Return custom image name with user rules * @return string Custom file name */ public function getFilename() { $filename = basename($this->url); if(preg_match('/(.*)?(\.+[^.]*)$/', $filename, $name_parts)) { $this->filename = $name_parts[1]; $postfix = $name_parts[2]; if (preg_match('/^(\.[^?]*)\?.*/i', $postfix, $postfix_extra)) { $postfix = $postfix_extra[1]; } } else { $this->filename = $filename; $postfix = ''; } $filename = $this->resolvePattern(WpAutoUpload::getOption('image_name')); return $filename . $postfix; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Improvement of URL matching’ is closed to new replies.