Image Watermark 5.x-1.0-alpha1 proposal (and port to 4.7)

schnizZzla - June 23, 2007 - 01:52
Project:Image watermark
Version:4.7.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:grateful_drupal_user
Status:patch (to be ported)
Description

The last two days I've been working on a new version of watermark.

It works fine with image module 5.x-1.2 and has some enhancements. I didn't really fix any existing issues, at least not knowingly. I've been working primary on features and issues that are important for my own project.

This could be Image Watermark version 5.x-1.0-alpha1. I would like to hear what Khalid Baheyeldin is going to say.

These tasks were accomplished:
=========================
- Image 5.x-1.2 compatibility
- Preserve image type
- Support alpha blending
- Apply watermark on uploaded images only => don't apply twice
- Watermarks on previews
- Watermark scaling, options: width percentage and minimum width in pixels
- Additional option to circumvent animated GIF incompatibility or just to disable watermark in some cases
  => toggles: exclude specific gallery terms e.g. exclude all images in the gallery "animated GIFs"

To do
=====
- option to select if image type should be preserved, because now this is by default: yes
- complete and proper implementation of watermark menu (local task for image module?)
  -> see changelog.txt!

- full settings form validation
- complete watchdog error reports

- decide if backwards compatibility needs to be implemented, concerning db path storage
  (dir removed --> http://drupal.org/node/142178)

- animated gif support (a detection to exclude gif images automatically or a method to process animated gifs)
  -> temp solution now: additional option to exclude images with specific vocabulary terms


CHANGELOG.txt
=============================================================================

5.x-1.0-alpha1 (inofficial version)
----------------------------
new:
- Preserve image type
- Alpha blending
- Apply watermark on uploaded images only
- Watermark on previews
- Watermark scaling, thanks to michael curry (inactivist), http://drupal.org/node/81161
-
Toggles: Exclude gallery terms

changes:
- assuming full path is stored in db ($dir removed)
- visible name is now "Image Watermark", project name is still "watermark"
- To be able to change our watermark settings for future images without modifying image settings and
  running into a new problem, watermark settings were moved to "Image Watermark" menu.
  This is a change due to the behaviour of image module that uses _image_build_derivatives every time
  image module settings has been saved. This causes watermarks to disappear or to appear an all image sizes.
  We don't change that behavior or interfere with it. Otherwise we need to store
  an addition copy of the original image to recreate watermars to hook into image_alter.
  This might be a new feature: trade space for automatic retroactivity...
- image creation process has been slightly changed to transform all images to truecolor first

5.x.-1.x-dev
------------
original version by Khalid Baheyeldin of http://2bits.com
$Id: watermark.module,v 1.5.2.1 2007/02/18 23:59:52 kbahey Exp $

====================================================================================

I hope this is a useful contribution to the drupal community...

I'm going to use it in a few days for my berlin based community BerlinerStrassen.com.

Good Night!

schnizZzzZz
3:51 AM in Berlin, Germany

AttachmentSize
watermark-5.x-1.0-alpha1-proposal.tar_.gz13.65 KB

#1

schnizZzla - June 23, 2007 - 02:03

oops, including path structure correctly, trying again..

AttachmentSize
watermark.tar_.gz 28.66 KB

#2

kbahey - June 23, 2007 - 02:21
Status:needs review» needs work

Good work.

Here are some suggestions:

- Re: "Apply watermark on uploaded images only => don't apply twice", please check the issue queue for a similar problem. If there is a fix for it, that is GREAT.
- Please send a proper patch (not the entire archive). See http://drupal.org/patch
- Check the code style. Run the module through the coder module for that.

Once these are done, I will include these changes.

Thanks!

#3

schnizZzla - June 23, 2007 - 02:47

thanks for the quick reply and suggestions!
going to bed now, but making a patch and stuff all that tomorrow (today)...

#4

grateful_drupal_user - June 23, 2007 - 14:20

I'll do the 4.7 back-port when this has been merged in to CVS for 5.x.

#5

schnizZzla - June 23, 2007 - 15:18

@inactivist
thank you

Ok, I've run the new version throung coder module with following settings:

X Drupal Coding Standards (every developer should use)
X Drupal Commenting Standards (every developer should use)
X Handle text in a secure fashion (very basic, needs work, but what it finds is good)

apply the checked coding reviews
X minor (most)

I eliminated all bad code style and applied all performance optimization suggestions.
Patch is coming...

#6

schnizZzla - June 24, 2007 - 19:20

Ok, I have the following files:

patches:
readme.txt.5_x-1_0-alpha1.patch
watermark.info.5_x-1_0-alpha1.patch
watermark.module.5_x-1_0-alpha1.patch

new files:
TODO.txt
CHANGELOG.txt

I did not know, if information that is going to be created automatically ($id$) has to be changed, so I didn't touch it.
I'm also wondering if I used the correct diff command, although I made it a diff -up ... all lines are replaced. Maybe too much changes?

I'm going to upload, into seperate comments, starting with:

watermark.module.5_x-1_0-alpha1.patch

AttachmentSize
watermark.module.5_x-1_0-alpha1.patch 26.63 KB

#7

schnizZzla - June 24, 2007 - 19:22

watermark.info.5_x-1_0-alpha1.patch

AttachmentSize
watermark.info_.5_x-1_0-alpha1.patch 864 bytes

#8

schnizZzla - June 24, 2007 - 19:23

readme.txt.5_x-1_0-alpha1.patch

AttachmentSize
readme.txt.5_x-1_0-alpha1.patch 3.34 KB

#9

schnizZzla - June 24, 2007 - 19:24

TODO.txt

AttachmentSize
TODO.txt 563 bytes

#10

schnizZzla - June 24, 2007 - 19:25

CHANGELOG.txt

AttachmentSize
CHANGELOG.txt 1.49 KB

#11

kbahey - June 24, 2007 - 20:12

Good work, but this patch is messed up.

First, it has Carriage Return (it is in DOS format) and hence every line comes up as changed in all the file. Please create it again with only Line Feed as the line separator (UNIX format).

Second, do not include every file in a separate patch. Just cd to the watermark directory, and create your patch there, all in one single file.

Third, the To Do file can be put at the end of the README. No need to be a separate file. The change log assumes I am going to name the module release alpha1. I don't intend to do that. I will just keep the name the same, since it is a daily snapshot anyway. So, just list the changes in the issue (I think you already did) and I will put that in the commit message).

So, once you correct these, I will review and commit.

#12

schnizZzla - June 24, 2007 - 21:15

I already thought it's messed up. I never saw a patch like this before.

"Second, do not include every file in a separate patch. Just cd to the watermark directory, and create your patch there, all in one single file."

I understand that you mean I should have made a patch against the whole directory, right?

"Third, the To Do file can be put at the end of the README. No need to be a separate file. The change log assumes I am going to name the module release alpha1. I don't intend to do that. I will just keep the name the same, since it is a daily snapshot anyway[..]"

You can decide that better as you're the maintainer. I change the name back.
Please put this updated information from changelog into the commit message:

new:
- Preserve image type
- Alpha blending
- Apply watermark on uploaded images only
- Watermark on previews
- Watermark scaling, thanks to michael curry (inactivist@gmail.com), http://drupal.org/node/81161
-
Toggles: Exclude gallery terms

changes:
- assuming full path is stored in db ($dir removed, http://drupal.org/node/142178)
- visible name is now "Image Watermark", project name is still "watermark"
- image creation process has been slightly changed to transform images to truecolor first
- Watermark settings moved to "Image Watermark" menu. This is a change due to the
  behaviour of image module that uses _image_build_derivatives every time settings has been saved.
  This caused watermarks to disappear or to appear on all image sizes.

The todo.txt I'm going to append that in readme.txt.

I think this is going to be more ping pong, maybe the next is going to be ok...

#13

schnizZzla - June 25, 2007 - 00:05

so, check this one, line endings should be ok and the other things

AttachmentSize
watermark.multi-issue.patch 25.78 KB

#14

kbahey - June 25, 2007 - 00:50
Status:needs work» fixed

Excellent!

I committed to 5.x and HEAD.

Please close or mark as duplicate all the other issues that you have fixed by this patch.

Thanks.

#15

schnizZzla - June 25, 2007 - 00:54

I'm happy.

Allright, gonna dupeclose them with a link to this case.

#16

schnizZzla - June 25, 2007 - 01:19

@inactivist

I think the whole thing can be rolled back to 4.7

You can contact me if you have any trouble. I think the main issue is the path storage in db tables in older image modules than 1.2 as this patch is optimized for this version of image module.

Issues handled by this patch:
http://drupal.org/node/81327 (closed)
http://drupal.org/node/135069 (closed)
http://drupal.org/node/142617 (closed)

Not closed, because I was not sure. This was opened for 4.7, so it's fixed when the whole patch is back-ported:
http://drupal.org/node/81498
http://drupal.org/node/81500

#17

schnizZzla - June 25, 2007 - 01:25

i forgot inactivist's scaling issue:

http://drupal.org/node/81161

#18

grateful_drupal_user - June 25, 2007 - 01:48

@schnizZzla: Create a "back-port 5.x enhancements" task against the 4.7 version, and shoot me an email at inactivist@gmail.com, and I'll assign it to me.

Thanks for this enhancement!

#19

kbahey - June 25, 2007 - 01:53
Version:5.x-1.x-dev» 4.7.x-1.x-dev
Status:fixed» patch (to be ported)

There is no need for a new task. This one is good enough. Status and version changed.

#20

grateful_drupal_user - June 25, 2007 - 02:31
Title:Image Watermark 5.x-1.0-alpha1 proposal» Image Watermark 5.x-1.0-alpha1 proposal (and port to 4.7)
Assigned to:Anonymous» grateful_drupal_user

Assigned

#21

schnizZzla - June 25, 2007 - 13:39

great, this takes this project to the next level!

@khalid
when back-port is done, it would be nice when you update the project description page with the new readme.

I'm going to setup and maintain a pure 5.x demo page that works with image 1.2 and the new watermark. If you want, you can link that additionally on the description page. Should I open an support issue for that, once it's ready to use?

#22

kbahey - June 25, 2007 - 13:53

If you can get the page HTML source for that page, and edit it to include your changes, then attach it to this issue, I will update the project page.

#23

schnizZzla - June 25, 2007 - 16:04

here it is. I updated this according to the readme and added some credits for me and inactivist. Also some status note about the 4.7 port and demo page, that can be easiely replaced or removed later.

AttachmentSize
watermark.description.html 2.82 KB

#24

schnizZzla - July 4, 2007 - 14:43

I've marked these issues as duplicate:

Applying Watermark based on taxonomy - http://drupal.org/node/81500
Saving files the same format as original - http://drupal.org/node/81498
Scale watermark to be proportional to image width - http://drupal.org/node/81161

#25

schnizZzla - July 4, 2007 - 17:04

I just want to inform that today I starde to work on:

new
- access control setting: manage watermarks
- node form: automatic watermark process is bypassed for roles with "manage watermark" access. Additionally a checkbox "Apply watermark" is available.

fix
- discovered that watermark applies once on preview, but twice on save

I think this update will be ready today.

@inactivist
It's better to wait for this update before port to 4.7

#26

schnizZzla - July 5, 2007 - 01:21

Okay the new feature was a bit tricky to implement, but here is my latest patch.
This patch is for 5.x and HEAD and can be ported to 4.7.

new feature

  • manage watermarks: checkbox "Apply watermark" for users with "manage watermarks" permssion. (Known minor bug by design: If you want to replace an image and "Apply watermark" is checked, when upload fails, e.g. because of wrong file type, watermark is applied to the image that you wanted to replace.)

fixed

  • watermark applies once on preview, but twice on submit

changes

  • hook_nodeapi rework and some structural changes
AttachmentSize
watermark.manager.patch 4.79 KB

#27

kbahey - July 5, 2007 - 01:36

Please create another issue for this, not one issue with many features.

#28

schnizZzla - July 6, 2007 - 11:47
 
 

Drupal is a registered trademark of Dries Buytaert.