Answer the question
In order to leave comments, you need to log in
Watermark for photos framework kohana, there is a problem, how to solve?
Hello , when adding a product, the photo is made into two parts, into a small and a large one, I added to add a watermark, a watermark is added to a large photo and a small one, how can I make it so that it is added only to a large photo.
Tell me please.
Photo editor and uploader.
// Загрузка фото для товара
public function _upload_img($file, $ext = NULL, $directory = NULL)
{
if ($directory == NULL) {
$directory = 'media/uploads';
$smalldirectory = 'media/uploads/small/';
}
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 < 250 OR $im->height < 250) {
return false;
} else {
//изменяет размеры большой фотки
$wm = Image::factory(DOCROOT.'media/images/waterznak.png');
$im->resize(800, 800);
$im->watermark($wm, NULL, NULL, 100);
$im->save("$directory/$filename.$ext");
//делает маленькую фотку
$im->resize(205, 205, Image::INVERSE);
//режет маленькую фотку до
$im->crop(205, 205);
$im->save("$smalldirectory/small_$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