oc-resizer-plugin/classes/FirstLetterStrategy.php

39 lines
930 B
PHP
Raw Normal View History

2020-10-25 20:53:10 +01:00
<?php
namespace Aweos\Resizer\Classes;
class FirstLetterStrategy {
public function sourcePath($fileName) {
return 'source';
}
public function sourceFileBasename($uploadedFile, $data) {
return str_slug($data['title']);
}
public function publicPath($filename) {
return strtolower($filename[0]);
}
public function smallFilename($filename, $width) {
return pathinfo($filename, PATHINFO_FILENAME).'-'.$width.'.'.pathinfo($filename, PATHINFO_EXTENSION);
}
2020-10-25 23:02:13 +01:00
public function versionRegex($filename) {
$ext = preg_quote(pathinfo($filename, PATHINFO_EXTENSION), '/');
$name = preg_quote(pathinfo($filename, PATHINFO_FILENAME), '/');
return "/^{$name}-[0-9]+\.{$ext}$/";
}
2020-10-25 20:53:10 +01:00
public function croppedPath() {
return 'cropped';
}
public function croppedFilename($filename, $crop) {
return $filename;
}
}