Keyword

I'm just trying to add a png watermark on image upload

More
13 years 3 months ago #84322 by Jordan Ivanov
Replied by Jordan Ivanov on topic I'm just trying to add a png watermark on image upload
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.

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.

More
13 years 3 months ago #84323 by innocence
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!
Attachments:

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #84324 by Jordan Ivanov
Replied by Jordan Ivanov on topic I'm just trying to add a png watermark on image upload
//Original image, //XLarge image, and the other ones are for the item image only.

//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.

More
13 years 3 months ago #84325 by innocence
Ididn´t know that difference between codes for item image and codes for gallery images. Thanks for that. I´m just using the item image by now, it´s all I needed. Will try the gallery images later.

 

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
  • Bevan Von Weichardt's Avatar
  • Offline
  • New Member
More
13 years 2 months ago #84326 by Bevan Von Weichardt
Replied by Bevan Von Weichardt on topic I'm just trying to add a png watermark on image upload
Hi Justin,

 

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.

More
13 years 2 months ago #84327 by eric67
Hello,

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.

More
13 years 2 months ago #84328 by eric67
Regarding my previous post I have to precise that I get this error message :

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.

More
13 years 2 months ago #84329 by Jordan Ivanov
Replied by Jordan Ivanov on topic I'm just trying to add a png watermark on image upload
Which folder exist? media/k2/galleries/ or media/k2/galleries/137/ ?

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.

More
13 years 2 months ago #84330 by eric67
Hi,

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.

More
13 years 2 months ago #84331 by eric67
humm... I have a doubt on Simple Image Gallery.

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.


Powered by Kunena Forum