- Posts: 663
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- I'm just trying to add a png watermark on image upload
I'm just trying to add a png watermark on image upload
- BBC
- Offline
- Platinum Member
Less
More
13 years 7 months ago #84312
by BBC
Replied by BBC on topic I'm just trying to add a png watermark on image upload
Don´t know. Wait for 2.5 stable.
Can give that statement because i compared all changes with Beyond Compare.
bunglehaze said:
There is already a fix in this thread which works perfectly well, I asked you to elaborate on your quote below as you seem to imply that something has been changed to make it simpler. How can you make statements like this, if you do not know the changes yourself?
Developers did something in new 2.5 SVN version.
Regarding watermark and images crop options.
So, it should be easy now. Just to make it to settings in xml files. :)
Can give that statement because i compared all changes with Beyond Compare.
bunglehaze said:
There is already a fix in this thread which works perfectly well, I asked you to elaborate on your quote below as you seem to imply that something has been changed to make it simpler. How can you make statements like this, if you do not know the changes yourself?
Developers did something in new 2.5 SVN version.
Regarding watermark and images crop options.
So, it should be easy now. Just to make it to settings in xml files. :)
Please Log in or Create an account to join the conversation.
- bunglehaze
- Offline
- Elite Member
Less
More
- Posts: 168
13 years 7 months ago #84313
by bunglehaze
Replied by bunglehaze on topic I'm just trying to add a png watermark on image upload
That still makes absolutely no sense at all - fair enough if you have a qualified answer about what you are posting about but it is of no use to anyone to post up a vague statement like you can add to xml files and it will be easy if you have no basis for where or how changes have been made. For less experienced visitors to this site posts like that tend to cause more confusion and problems IMHO.
I have no need to wait for 2.5 stable because my site is running 2.5SVN and I am happily working through the modifications I need for my site which other than a performance issue that is carried over from 2.4.1 is working just fine, there have been a fair few changes under the hood but nothing points to a watermark function being added to K2 itself from what I can see.
BBC said:
Don´t know. Wait for 2.5 stable.
Can give that statement because i compared all changes with Beyond Compare.
bunglehaze said:
There is already a fix in this thread which works perfectly well, I asked you to elaborate on your quote below as you seem to imply that something has been changed to make it simpler. How can you make statements like this, if you do not know the changes yourself?
Developers did something in new 2.5 SVN version.
Regarding watermark and images crop options.
So, it should be easy now. Just to make it to settings in xml files. :)
I have no need to wait for 2.5 stable because my site is running 2.5SVN and I am happily working through the modifications I need for my site which other than a performance issue that is carried over from 2.4.1 is working just fine, there have been a fair few changes under the hood but nothing points to a watermark function being added to K2 itself from what I can see.
BBC said:
Don´t know. Wait for 2.5 stable.
Can give that statement because i compared all changes with Beyond Compare.
bunglehaze said:
There is already a fix in this thread which works perfectly well, I asked you to elaborate on your quote below as you seem to imply that something has been changed to make it simpler. How can you make statements like this, if you do not know the changes yourself?
Developers did something in new 2.5 SVN version.
Regarding watermark and images crop options.
So, it should be easy now. Just to make it to settings in xml files. :)
Please Log in or Create an account to join the conversation.
- Jordan Ivanov
- Offline
- New Member
Less
More
- Posts: 10
13 years 5 months ago #84314
by Jordan Ivanov
Replied by Jordan Ivanov on topic I'm just trying to add a png watermark on image upload
This handles only the item image, but doesn't work for the gallery images.
I added $handle->image_watermark on line 440 and line 450, but no success.
Does anyone know how can I add watermark to the gallery images?
I added $handle->image_watermark on line 440 and line 450, but no success.
Does anyone know how can I add watermark to the gallery images?
Please Log in or Create an account to join the conversation.
- Jordan Ivanov
- Offline
- New Member
Less
More
- Posts: 10
13 years 5 months ago #84315
by Jordan Ivanov
Replied by Jordan Ivanov on topic I'm just trying to add a png watermark on image upload
This handles only the item image, but doesn't work for the gallery images.
I added $handle->image_watermark on few other places, but no success.
Can anyone help me to add watermark to gallery images?
I added $handle->image_watermark on few other places, but no success.
Can anyone help me to add watermark to gallery images?
Please Log in or Create an account to join the conversation.
- Jordan Ivanov
- Offline
- New Member
Less
More
- Posts: 10
13 years 5 months ago #84316
by Jordan Ivanov
Replied by Jordan Ivanov on topic I'm just trying to add a png watermark on image upload
Any suggestions please
Please Log in or Create an account to join the conversation.
- JTJ van Loendersloot
- Offline
- New Member
Less
More
- Posts: 4
13 years 5 months ago #84317
by JTJ van Loendersloot
Replied by JTJ van Loendersloot on topic I'm just trying to add a png watermark on image upload
Look in administrator > components > com_k2 > models > item.php and search for :
//Gallery
Between:
JFile::delete($savepath.DS.$handle->file_dst_name);
$handle->Clean();
HERE!!>>>>
and:} else {
$mainframe->redirect('index.php?option=com_k2&view=items', $handle->error, 'error');
Place this code:
// Digitechs add 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->image_watermark = '/home/******/public_html/<--absolute path to watermark-->watermark.png';
$handle->image_watermark_position = 'BR';
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->Process($savepath.DS.$row->id);
} closedir($dir);
}
Good luck.
//Gallery
Between:
JFile::delete($savepath.DS.$handle->file_dst_name);
$handle->Clean();
HERE!!>>>>
and:} else {
$mainframe->redirect('index.php?option=com_k2&view=items', $handle->error, 'error');
Place this code:
// Digitechs add 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->image_watermark = '/home/******/public_html/<--absolute path to watermark-->watermark.png';
$handle->image_watermark_position = 'BR';
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->Process($savepath.DS.$row->id);
} closedir($dir);
}
Good luck.
Please Log in or Create an account to join the conversation.
- Jordan Ivanov
- Offline
- New Member
Less
More
- Posts: 10
13 years 5 months ago #84318
by Jordan Ivanov
Replied by Jordan Ivanov on topic I'm just trying to add a png watermark on image upload
Great Justin!
After two evenings of tumbling in the dark, something like this was in my ToDo list. You saved me big headache.
Tonight I'll try it.
Thank you very much.
After two evenings of tumbling in the dark, something like this was in my ToDo list. You saved me big headache.
Tonight I'll try it.
Thank you very much.
Please Log in or Create an account to join the conversation.
- Jordan Ivanov
- Offline
- New Member
Less
More
- Posts: 10
13 years 5 months ago #84319
by Jordan Ivanov
Replied by Jordan Ivanov on topic I'm just trying to add a png watermark on image upload
Thanks again Justin.
I didn't succeed from the first try, I still got white screen on item save.
I did some little improvements and now it works as I wanted.
I increased max_execution_time and max_input_time in php.ini :
max_input_time = 300max_execution_time = 90
Also I added image_resize, so finally the code looks like this:
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 = true;
$handle->image_x = 1024;
$handle->image_ratio_y = true;
$handle->image_watermark = '/home/user/public_html/images/watermark.png';
$handle->image_watermark_position = 'BR';
$handle->image_convert = 'jpg';
$handle->jpeg_quality = 85;
$handle->Process($savepath.DS.$row->id);
$handle->Clean();
}
closedir($dir);
}
It will be good if JoomlaWorks include it in K2.
I didn't succeed from the first try, I still got white screen on item save.
I did some little improvements and now it works as I wanted.
I increased max_execution_time and max_input_time in php.ini :
max_input_time = 300max_execution_time = 90
Also I added image_resize, so finally the code looks like this:
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 = true;
$handle->image_x = 1024;
$handle->image_ratio_y = true;
$handle->image_watermark = '/home/user/public_html/images/watermark.png';
$handle->image_watermark_position = 'BR';
$handle->image_convert = 'jpg';
$handle->jpeg_quality = 85;
$handle->Process($savepath.DS.$row->id);
$handle->Clean();
}
closedir($dir);
}
It will be good if JoomlaWorks include it in K2.
Please Log in or Create an account to join the conversation.
- JTJ van Loendersloot
- Offline
- New Member
Less
More
- Posts: 4
13 years 5 months ago #84320
by JTJ van Loendersloot
Replied by JTJ van Loendersloot on topic I'm just trying to add a png watermark on image upload
Glad it worked out for you.
Please Log in or Create an account to join the conversation.
- innocence
- Offline
- New Member
Less
More
- Posts: 16
13 years 3 months ago #84321
by innocence
Replied by innocence on topic I'm just trying to add a png watermark on image upload
Hi Jordan.
You are clearly not the one who needs to implement the watermark feature in K2. I´m desperately needing to implement this feature.
I have tried the code you published here but with no success! I see your code working in www.alcatraz.bg and I just got tired of trying to do the same, I don´t know what else to do!
I´m testing on a local server (AppServ 2.5.10 under Windows XP). Joomla! v1.5.23, latest K2 stable release...
Could you please help me in any way? Could you please post or send me your item.php file you are using on alcatraz.bg ?
I´ll be just here waiting for your answer. Sorry about my english! And thanks in advance!!!
Jordan Ivanov said:
Thanks again Justin.
I didn't succeed from the first try, I still got white screen on item save.
I did some little improvements and now it works as I wanted.
I increased max_execution_time and max_input_time in php.ini :
max_input_time = 300max_execution_time = 90
Also I added image_resize, so finally the code looks like this:
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 = true;
$handle->image_x = 1024;
$handle->image_ratio_y = true;
$handle->image_watermark = '/home/user/public_html/images/watermark.png';
$handle->image_watermark_position = 'BR';
$handle->image_convert = 'jpg';
$handle->jpeg_quality = 85;
$handle->Process($savepath.DS.$row->id);
$handle->Clean();
}
closedir($dir);
}
It will be good if JoomlaWorks include it in K2.
You are clearly not the one who needs to implement the watermark feature in K2. I´m desperately needing to implement this feature.
I have tried the code you published here but with no success! I see your code working in www.alcatraz.bg and I just got tired of trying to do the same, I don´t know what else to do!
I´m testing on a local server (AppServ 2.5.10 under Windows XP). Joomla! v1.5.23, latest K2 stable release...
Could you please help me in any way? Could you please post or send me your item.php file you are using on alcatraz.bg ?
I´ll be just here waiting for your answer. Sorry about my english! And thanks in advance!!!
Jordan Ivanov said:
Thanks again Justin.
I didn't succeed from the first try, I still got white screen on item save.
I did some little improvements and now it works as I wanted.
I increased max_execution_time and max_input_time in php.ini :
max_input_time = 300max_execution_time = 90
Also I added image_resize, so finally the code looks like this:
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 = true;
$handle->image_x = 1024;
$handle->image_ratio_y = true;
$handle->image_watermark = '/home/user/public_html/images/watermark.png';
$handle->image_watermark_position = 'BR';
$handle->image_convert = 'jpg';
$handle->jpeg_quality = 85;
$handle->Process($savepath.DS.$row->id);
$handle->Clean();
}
closedir($dir);
}
It will be good if JoomlaWorks include it in K2.
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- I'm just trying to add a png watermark on image upload