- Posts: 10
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
- Jordan Ivanov
-
- Offline
- New Member
Did you modify the php.ini file? Are you sure you modified the correct file? Set "display_errors = On" and maybe you'll find the problem.
What is the size of the images zip file? Try with a smaller zip file, less than 1MB.
I have attached my item.php.
If you still can not find the problem, try it on other server, non-windows.
Good luck
Paul A. said:
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!!!
Please Log in or Create an account to join the conversation.
- innocence
-
- Offline
- New Member
- Posts: 16
Worked directly replacing item.php with yours, and setting the location of my local png watermark image!
I was missing the code lines in //Original image, //XLarge image, and the other ones.
Tested in my AppServ Apache local server, and in unix in one of my hosting providers. Worked like a charm in both of them.
I´m very happy and I really appreciate your kind goodwill gesture, Jordan... It probably saved me hours or even days of research, since I´m just a designer, not a programmer. Not very skilled in php, at all...
My big THANKS from Argentina. Hope it helps more people too!
Please Log in or Create an account to join the conversation.
- Jordan Ivanov
-
- Offline
- New Member
- Posts: 10
//galery watermark section is only for the gallery images.
It is very important to modify the php settings in php.ini, othewise you will got error message or white screen on larger zip files.
Like I said, it will be very good if it is included as an option in K2 and SIG, and I don't think it will be very difficult for the JoomlaWorks programmers.
Paul A. said:
hey hey hey!!!! It WORKED, Jordan!
Worked directly replacing item.php with yours, and setting the location of my local png watermark image!
I was missing the code lines in //Original image, //XLarge image, and the other ones.
Tested in my AppServ Apache local server, and in unix in one of my hosting providers. Worked like a charm in both of them.
I´m very happy and I really appreciate your kind goodwill gesture, Jordan... It probably saved me hours or even days of research, since I´m just a designer, not a programmer. Not very skilled in php, at all...
My big THANKS from Argentina. Hope it helps more people too!
Please Log in or Create an account to join the conversation.
- innocence
-
- Offline
- New Member
- Posts: 16
Some php.ini settings can be overrided with the "PHP Settings" plugin for Joomla!, it works really nice. (In case you don´t hace access to hosting service php settings.
I still don´t understand why the watermark functionality is not included in K2 core...
SIG people, as I read in forums, don´t care about this option. The say the don´t have planned to add it to SIG by now... :S
Please Log in or Create an account to join the conversation.
- Bevan Von Weichardt
-
- Offline
- New Member
- Posts: 11
Here is my item.php snippet... am i doing this right? (using mamp)
//XLarge image //location of the watermark $handle->image_watermark = '/Applications/MAMP/htdocs/crashtackle/images/stories/watermark_xl.png'; //position of the watermark $handle->image_watermark_position = 'BR'; $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_convert = 'jpg'; $handle->jpeg_quality = $params->get('imagesQuality'); $handle->file_auto_rename = false; $handle->file_overwrite = true; $handle->file_new_name_body = $filename.'_XL'; if (JRequest::getInt('itemImageXL')) { $imageWidth = JRequest::getInt('itemImageXL'); } else { $imageWidth = $params->get('itemImageXL', '800'); } $handle->image_x = $imageWidth; $handle->Process($savepath);
Justin van Loendersloot said:
I'm have a debian server, so you should ask someone else. I use the complete base path.
Put $handle->image_watermark = 'path to the watermark' in administrator > components > com_k2 > models > item.php
So you get something like this:
around line 213;
//XLarge image
//location of the watermark
$handle->image_watermark = '/home/*************/public_html/images/stories/watermark/watermark_xl.png';
//position of the watermark
$handle->image_watermark_position = 'BR';
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_XL';
if (JRequest::getInt('itemImageXL')) {
$imageWidth = JRequest::getInt('itemImageXL');
} else {
$imageWidth = $params->get('itemImageXL', '800');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);
Please Log in or Create an account to join the conversation.
- eric67
-
- Offline
- New Member
- Posts: 7
I tried using Jordan's item.php file and it works for the main image (thanks Jordan)
but for the gallery, I get an error. The tag is displayed instead the images. eg. {gallery}137{/gallery}
I use last K2 version 2.4.1 and last version of Simple Image Gallery PRO 2.5.2
Any idea?
Thanks,
Eric.
Please Log in or Create an account to join the conversation.
- eric67
-
- Offline
- New Member
- Posts: 7
There was a problem rendering your image gallery. Please make sure that the folder you are using in the Simple Image Gallery PRO plugin tags exists and contains valid image files. The plugin could not locate the folder: media/k2/galleries/137
Of course, the folder exist but it is empty. The images are not saved... Any idea why?
Eric
Please Log in or Create an account to join the conversation.
- Jordan Ivanov
-
- Offline
- New Member
- Posts: 10
Find where are the images saved, check in images/ or images/stories/
Check your GD and php versions and settings. I'm using PHP Version 5.2.17 and GD Version bundled (2.0.34 compatible).
Did you modify the php.ini file? Are you sure you modified the correct file? Set "display_errors = On" and maybe you'll find the problem.
What is the size of the images zip file? Try with a smaller zip file, less than 1MB.
Please Log in or Create an account to join the conversation.
- eric67
-
- Offline
- New Member
- Posts: 7
Below the error message I get:There was a problem rendering your image gallery. Please make sure that the folder you are using in the Simple Image Gallery PRO plugin tags exists and contains valid image files. The plugin could not locate the folder: media/k2/galleries/143
The folder "media/k2/galleries/143" exists. It seems that Simple Image Gallery plugin creates automatically the final folder, I mean "143". 143 is the K2 article ID in fact.
The root folder in Simple Image Gallery plugin is "media/k2/galleries". Is that correct?
I tried to set the root folder with the same string + "/143", and modified the same article (the one with ID 143) but I get the same error...
Images are not saved neither in images/ nor images/stories/ but in media/k2/galleries/xxxxxx
xxxxxx is the ID of K2 items. So, there are as many folders than items...
The PHP version is 5.2.16 with GD library bundled (2.0.34 compatible).I did not modify the php.ini. In fact, I can't access it because the site is not on a dedicated server.I use very small file to test the process. The main image is 108Ko and the zip file, which contains only 2 images is 215Ko.
What do you mean with "Are you sure you modified the correct file? ". Did you mean item.php? In that case, yes.The process works cause I can have the main image with the watermark. Only the gallery does not work.
Eric.
Please Log in or Create an account to join the conversation.
- eric67
-
- Offline
- New Member
- Posts: 7
I went back to an older version, 2.5.1 instead 2.5.2, and the error label message is a little bit different.. may be something has been modified regarding the images path...
Please, what is the version of simple image gallery you are using?
Please Log in or Create an account to join the conversation.
- Andreus Primulus
-
- Offline
- New Member
- Posts: 1
Regarding adding watermarks in product gallery, I had the very same problem - i.e. nothing worked.
So after a few frustrating hours I figured it's the permissions problem. Joomla utilizes 2 users - the httpd user and the ftp user. I also switched to plain gd and built-in php file handling. I somewhat modified a script i've found online - now it all works (for me at least). The idea is to create a temp folder for output images with php (httpd user), then do the necessary operations with joomla JFolder class (ftp user).
In '/administrator/components/com_k2/models/item.php' right after these lines:
Log in or Create an account to join the conversation.
- Eugen
-
- Offline
- New Member
- Posts: 3
I tried both options which were stated here and it doesnt work. Pictures in gallery are without watermark. Pictures in K2 are with watermark so this is ok.
I have J3 and k2 2.67. Might be something else needs to be done?
Thanks for any help to get watermark on SIG PRO
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
Since you are using Joomla! 3 you might want to consider updating your K2 version to DEV 2.6.8 from getk2.org/assets/get/
Please Log in or Create an account to join the conversation.
- Eugen
-
- Offline
- New Member
- Posts: 3
Yiota Ziaggou wrote: I'm afraid that for SIG Pro support you will have to open a ticket to JoomlaWorks ticketing system www.joomlaworks.net/dashboard/tickets
Since you are using Joomla! 3 you might want to consider updating your K2 version to DEV 2.6.8 from getk2.org/assets/get/
Thanks for suggestion, but this update will help in someway with my problem with watermarks?
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
The K2 update is suggested for Joomla! 3.2 version since it solves some compatibility issues.
Please Log in or Create an account to join the conversation.
- Eugen
-
- Offline
- New Member
- Posts: 3
Well, I did, and help from them( same Yiota) was: I'm afraid that you can't. The watermark should be embedded to the images you upload in order to exist when someone chooses to download them either with the download link in the popup or a right click.Yiota Ziaggou wrote: The JoomlaWorks team will help you with the watermark issue. Try to open a ticket as I suggested.
Wow, great support! Same answer as in 2010.
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
Please Log in or Create an account to join the conversation.
- Mohsen Babaei
-
- Offline
- Junior Member
- Posts: 20
why? can anyone help me?
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
The code starts in line 624.
Please Log in or Create an account to join the conversation.
- felipe
-
- Offline
- New Member
- Posts: 5
Thanks!
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