I store the original image path(included file name) in db when upload an image.
For example:
img/uploaded/photo.jpg
Then I generate its thumbnail and store in below directory NOT in db.
/img/uploaded/thumbs/photo_thumb.jpg
And I have following function but no idea how to get the thumb which belong to the url in db.
//ie: $file is img/uploaded/photo.jpg
public function get_thumb($file)
{
//get the path without filename
$get_path = dirname($file) . "/thumbs/";
//result img/uploaded/thumbs/ (how can i get the photo_thumb.jpg) here?
return $get_path;
}
Edit basename($file) to get filename from path but how to add _thumb.jpg?