Answer the question
In order to leave comments, you need to log in
Photo uploader, kohana, how to implement so that the extension does not change when uploading ??
Hello, when uploading a photo, if the picture is of a different type of extension like .png .gif, etc., the photo uploader processes the photo and makes it in
.jpg does.
Loader
public function _uplakcii_img($file, $ext = NULL, $directory = NULL)
{
if ($directory == NULL) {
$directory = 'media/uploads/akcii/';
}
if ($ext == NULL) {
$ext = 'jpg';
}
$symbols = '0123456789abcdefghijklmnopqrstuvwxyz';
$filename = '';
for ($i = 0; $i < 10; $i++) {
$filename .= rand(1, strlen($symbols));
}
$im = Image::factory($file);
if ($im->width < 50 OR $im->height < 50) {
return false;
} else {
$im->save("$directory/$filename.$ext");
return "$filename.$ext";
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question