We need to edit file - item.php which exists in our administrator folder, full path:
\administrator\components\com_k2\models\item.php
first we need to define the variable:
$img_url_watermark = "../images/watermark.png"; //(line 202)
near the comment line
//Original image
Then we need to paste the lines after each image comment to which we want to add watermark (i recommand not to add to small and xsmall... images )
$handle->image_watermark = $img_url_watermark;
$handle->image_watermark_position = "TL";
Than we need to add the code:
//gallery watermark
if($dir = opendir($savepath.DS.$row->id)) {
while (false !== ($file = readdir($dir))) {
$handle = new Upload ($savepath.DS.$row->id.'/'.$file);
$handle->allowed = array('image/*');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->image_resize = ture;
$handle->image_x = 1024;
$handle->image_ratio_y = true;
$handle->image_watermark = $img_url_watermark;
$handle->image_watermark_position = "TL";
$handle->image_convert = "jpg";
$handle->jpeg_quality = 85;
$handle->Process($savepath.DS.$row->id);
$handle->Clean();
}
closedir($dir);
}
//end
After the code:
if (!JArchive::extract($savepath.DS.$handle->file_dst_name, $savepath.DS.$row->id)) {
$mainframe->redirect('index.php?option=com_k2&view=items', JText::_('Gallery upload error: Cannot extract archive!'), 'error');
} else {
$row->gallery = '{gallery}'.$row->id.'{/gallery}';
}
JFile::delete($savepath.DS.$handle->file_dst_name);
$handle->Clean();
Its about 430~ line
That is all.... done :)
p.s. some sources where the solution was fount
http://api.ning.com/files/HXT6DGp5WSJFHL5RzYp-Jb*WUL4Ep5eAy*opKr8s8KN4pt-DDD92wDPKlmNCmWeQd8msVcosqVIjDLKY3jJ-pZ*6PcJz56pR/diff1.gif
http://api.ning.com/files/*txNFL3oxugapDshDybYqwZ6pM1HRBera8DL7uZp5keDIc40jfg8UZf-SEvT3aVakQ35-yRj-RYTlZXBcGxHOa0R2gQPSkPN/diff2and3.gif
http://api.ning.com/files/2ryzVIrGkDjAz*ZMCXk1aYFdbHTiKTrxNSCfUK97YXCGDhmGv7azhnkMQ1cnJp7EdCivLSbtwdV1HmnwnnjnleMveePM*1LS/diff4.gif
http://community.getk2.org/forum/topics/im-just-trying-to-add-a-png
\administrator\components\com_k2\models\item.php
first we need to define the variable:
$img_url_watermark = "../images/watermark.png"; //(line 202)
near the comment line
//Original image
Then we need to paste the lines after each image comment to which we want to add watermark (i recommand not to add to small and xsmall... images )
$handle->image_watermark = $img_url_watermark;
$handle->image_watermark_position = "TL";
Than we need to add the code:
//gallery watermark
if($dir = opendir($savepath.DS.$row->id)) {
while (false !== ($file = readdir($dir))) {
$handle = new Upload ($savepath.DS.$row->id.'/'.$file);
$handle->allowed = array('image/*');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->image_resize = ture;
$handle->image_x = 1024;
$handle->image_ratio_y = true;
$handle->image_watermark = $img_url_watermark;
$handle->image_watermark_position = "TL";
$handle->image_convert = "jpg";
$handle->jpeg_quality = 85;
$handle->Process($savepath.DS.$row->id);
$handle->Clean();
}
closedir($dir);
}
//end
After the code:
if (!JArchive::extract($savepath.DS.$handle->file_dst_name, $savepath.DS.$row->id)) {
$mainframe->redirect('index.php?option=com_k2&view=items', JText::_('Gallery upload error: Cannot extract archive!'), 'error');
} else {
$row->gallery = '{gallery}'.$row->id.'{/gallery}';
}
JFile::delete($savepath.DS.$handle->file_dst_name);
$handle->Clean();
Its about 430~ line
That is all.... done :)
p.s. some sources where the solution was fount
http://api.ning.com/files/HXT6DGp5WSJFHL5RzYp-Jb*WUL4Ep5eAy*opKr8s8KN4pt-DDD92wDPKlmNCmWeQd8msVcosqVIjDLKY3jJ-pZ*6PcJz56pR/diff1.gif
http://api.ning.com/files/*txNFL3oxugapDshDybYqwZ6pM1HRBera8DL7uZp5keDIc40jfg8UZf-SEvT3aVakQ35-yRj-RYTlZXBcGxHOa0R2gQPSkPN/diff2and3.gif
http://api.ning.com/files/2ryzVIrGkDjAz*ZMCXk1aYFdbHTiKTrxNSCfUK97YXCGDhmGv7azhnkMQ1cnJp7EdCivLSbtwdV1HmnwnnjnleMveePM*1LS/diff4.gif
http://community.getk2.org/forum/topics/im-just-trying-to-add-a-png