<?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);
    }

    public function versionRegex($filename) {
        $ext = preg_quote(pathinfo($filename, PATHINFO_EXTENSION), '/');
        $name = preg_quote(pathinfo($filename, PATHINFO_FILENAME), '/');

        return "/^{$name}-[0-9]+\.{$ext}$/";
    }

    public function croppedPath() {
        return 'cropped';
    }

    public function croppedFilename($filename, $crop) {
        return $filename;    
    }

}