Media watermark module allows to add watermark to image files (.jpg, .jpeg, .gif, .png) while they are uploading into CMS through media module. After installation follow this path yoursite.com/file/add here you will find "Add watermark" checkbox. Check it and two test watermarks will be available in select list. Add file to upload and submit form. Editing watermark is very easy just click on its image. If you don't need to add watermark to uploaded file just don't check "Add watermark" checkbox.
Project link:
https://drupal.org/sandbox/Bogdan1988/2036479
Git clone command:
git clone http://git.drupal.org/sandbox/Bogdan1988/2036479.git media_watermark
Manual reviews of other projects:
https://drupal.org/comment/8136721#comment-8136721
https://drupal.org/comment/8136805#comment-8136805
https://drupal.org/node/1962734#comment-8139593
Another three manual reviews
https://drupal.org/node/2122451#comment-8184889
https://drupal.org/comment/8185001#comment-8185001
https://drupal.org/comment/8185059#comment-8185059
Comment | File | Size | Author |
---|---|---|---|
#22 | media_watermark-batch_errors.png | 196.4 KB | dman |
#21 | media_watermark-errors_when_applying.drupal7.gadget.png | 296.43 KB | dman |
#20 | media_watermark_confuses_me.png | 51.68 KB | dman |
instructions for media watermark module.odt | 173.03 KB | Bogdan1988 |
Comments
Comment #1
PA robot CreditAttribution: PA robot commentedLink to the project page and git clone command are missing in the issue summary, please add them.
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #1.0
PA robot CreditAttribution: PA robot commentedadded drupal git repository link
Comment #2
Bogdan1988 CreditAttribution: Bogdan1988 commentedComment #3
PA robot CreditAttribution: PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://ventral.org/pareview/httpgitdrupalorgsandboxBogdan19882036479git
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #4
Bogdan1988 CreditAttribution: Bogdan1988 commentedComment #5
captainpants CreditAttribution: captainpants commentedHello Bogdan1988,
Great idea for this module but there are some things that need resolved.
Comment #6
Krizalys CreditAttribution: Krizalys commentedHello Bogdan1988,
I reviewed your module. For me, images were uploading correctly but without a watermark. I'm not sure why.
Nevertheless, here are some suggestions to improve it and help it to be accepted:
I would be glad to review your module again once these tasks have been taken into consideration.
Comment #7
Krizalys CreditAttribution: Krizalys commentedI would be glad to review your module again once these tasks have been taken into consideration.
Comment #8
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you captainpants. I will fix error and will change project page.
Comment #9
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you Krizalys for detailed review. I will take into consideration all your suggestions. Thank you!
Comment #9.0
Bogdan1988 CreditAttribution: Bogdan1988 commentedadded git clone and path to project
Comment #10
Bogdan1988 CreditAttribution: Bogdan1988 commentedComment #11
dstorozhukWhat is the difference between Image actions module, which also provide a watermark effect?
Comment #12
Bogdan1988 CreditAttribution: Bogdan1988 commentedFirst difference is module size and administrative interface with select list of available watermarks which is situated on any media file upload form. Also there are support of multiple files watermarking per one upload and it is very useful for sites with great amount of media galleries.
Comment #13
dman CreditAttribution: dman commentedI am the maintainer of "Image Actions" and I welcome this module into the space, as I believe (based on the project description) it helps user experience in a different place than the actual "image actions" do.
However, I found the current project page unformatted and difficult to understand. Like, unreadable.
I tried:
Enabling the current D7 of Media watermark.
- I got an error on install. It seems this has a hard dependency on core image module 7005+ That's not your fault, but it would be nice if other Drupal 7 users did not depend on this or there was a graceful fallback.
- visiting admin/config/media/watermark the 'add' option is in a subtle tab. Many Drupal modules at least prompt us to "add a new X" if the current list is empty.
- On my very first attempt, I found that GIF files were not allowed/ Only PNG could be watermarks. Hm.
- On selection a PNG, I got a warning
though that may have been mostly due to my dirty test platform. Not sure.
... And for further info you supply instructions in ODT?
Well, no.
For developers, the instructions are in txt, html, or md. This does not work on the commandline.
Opening that document was ... quite awful.
I could figure out that the next step (I think) is to use media module to upload an image and there may be additional options for watermarking.
... I could not immediately see how to add my new watermark to existing media. As available in the media_modle library at admin/content/file
- when trying to upload a new file, I saw only the last uploaded watermark, and no ability to upload.
I think I need to re-test on a clean site that has no existing media assets to see how it performs. In the meantime ... have you tested to see what does happen if you turn this module on in an existing site? I'm getting many very hard-to-explain errors when enabling this on a working (demo) site...
Comment #14
sreynen CreditAttribution: sreynen commentedI think we can call this "needs work" based on #13.
Comment #15
dman CreditAttribution: dman commentedI'll admit that my trial was not a 'clean-room' test as I usually do. I had a scratch site already using media_module that I inflicted upon it.
But the real-world environment is like that. We need to anticipate what happens if someone installs this module on an existing site that already has a number of assets in play.
My test site was not deliberately difficult - I just gave an honest step-by-step user report of what happened when I turned this on on a previously OK (though maybe unusual) site that was using media.module already.
How many error conditions have you anticipated and handled in the code? This is the test...
Comment #16
Bogdan1988 CreditAttribution: Bogdan1988 commentedHello dman, thank you for your comment and your notes. Yes I tried this module on clean drupal 7 site and it worked well. But I don't have imagecache_actions module on my demo site.
Comment #17
Bogdan1988 CreditAttribution: Bogdan1988 commentedAbout this: How many error conditions have you anticipated and handled in the code? This is the test... Please, give me some examples where error handling is necessary?
Comment #18
dman CreditAttribution: dman commentedMy issue was not with trying this module on a clean site (which is easier) but trying it on an existing one - which is harder to predict.
To replicate somewhat:
* I built a new empty site using 'default' install profile
* Added media module and media field.
* added a media field to my articles content type
* Added three articles, with image media assets attached
Assume at this point I have something like an existing site...
* enabled the media watermark module, and visited admin/config/media/watermark
* added a new logo for watermarking. PNG type this time.
* visited my current media library at admin/content/file - could not see how to add a watermark there.
???? This can have no effect on existing assets?
Tried adding another article. When adding a media asset, the new logo was dominating my UI. At least I can see it's doing something. unhelpful though.
So, having chosen a watermark at that point - while making a node. .... where do I see it? I viewed my new page, that had a "watermarked" media (a png) embededded -but saw no change to the image.
Where do watermarks happen? if not to derivative images used in displays, then where...?
On re-editing the filed config (eg)
"The file used in the Watermark image field may not be referenced.
I'm lost on how to use this. I need to spend a few hours deciphering the ODF maybe.
Comment #19
Bogdan1988 CreditAttribution: Bogdan1988 commentedWhere do watermarks happen? if not to derivative images used in displays, then where...? - watermarks happen when file uploading and uploaded image is changed. Please try this easy way follow admin/content/media + Add file then chose image to upload and chose watermark if you had more then one. Then submit form and click on the most recent file in table on this page admin/content/media. And you will see your watermarked image. To see it on node you should use file_entity module. Please, look here https://drupal.org/node/1793548.
Comment #20
dman CreditAttribution: dman commentedSorry, it seems that I had a significantly older (one year old) version of media module running. Many of the confusing errors and scrambled UI I was seeing may have been because this module requires a newer version of 'media' than the site had installed?
I tried upgrading media module to the latest 2.x code - and now that's just broken - not your fault.
Is there a specific version of media module that you have successfully been using?
Comment #21
dman CreditAttribution: dman commentedUpdated media.module and file_entity to their more recent stable releases.
Got a little further this time.
Was able to configure a watermark to use.
Added a media field to a content type and started to create content.
When adding the media field, to try and attach a PNG, the popup showed my watermark (above the normal file upload area - I really think it should be secondary)
When trying to continue, I got the attached error.
I'm guessing that you don't allow watermarks to be applied to PNG files?
Comment #22
dman CreditAttribution: dman commentedtried with a JPEG instead. Got one screen further this tie, then batch errors and a WSOD when trying to 'finish'
Had to visit a new page, and found this:
... this happens each time.
* create content
* attach media item
* upload a jpeg
* 'Save'
= Batch error "Fatal error: Call to a member function getAllItems() on a non-object in /Library/WebServer/Documents/drupal7/includes/batch.inc on line 465" and WSOD
Comment #23
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you dman for your detailed test. I will try to use media_watermark with different versions of media and file_entity modules. Also I will add support of gif watermarks and possibly allow adding watermarks on png. Versions of media and file_entity I used in my test 7.x-1.3. I will try to avoid all errors and then proceed to new review. Thank you. I would appreciate if you will test it after enhancements.
It is strange I mean batch errors. Batch should be invoked only when we try to upload multiple images (when we use plupload widget). I should investigate and fix it. Thank you!
Comment #24
Bogdan1988 CreditAttribution: Bogdan1988 commentedAdded gif watermark support, also changed admin interface (added table sort and pagination for watermarks). Added two watermarks .gif and .png on install. Added menu local action "add watermark". Should mention this module supports only 7.x - 2.x media and file_entity. Thank you all, who will test this module.
Comment #24.0
Bogdan1988 CreditAttribution: Bogdan1988 commentedchanged git clone branch
Comment #25
bneil CreditAttribution: bneil commentedBogdan1988, please change the git command in the issue summary to use the non-maintainer url.
You should also be working in your 7.x-1.x branch instead of 7.x-1.1.
Documentation standards-
Your .module @file docblock summary should be a full sentence ending in punctuation.
Your other @file docblocks have multiple lines. Include a blank line between the summary and further documentation.
Use your function docblock to describe the function which adds a lot of value for developers reading your code. Some of your docblock summaries are "Function" prefixed to the name of the function. e.g.
You may want to clarify the description of the permission you are defining. Right now it is confusing. Perhaps something like "Manage watermarks on file entities".
Seeing the "No Watermark" checkbox on file upload seems like an anti-pattern. Consider changing this to Add Watermark which will then present the watermark options. Also, consider adding this at the bottom of the upload form (or it's own step in the wizard) so it's not the first thing someone seems when they upload their file.
Comment #26
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you bneil I will consider all your comments.
Comment #27
drupalfan79 CreditAttribution: drupalfan79 commentedWhen I open admin/config/media/image-styles/edit/media_watermark, it shows error:
Notice: Undefined index: height in theme_image_resize_summary() (line 860 of F:\wamp\www\location\modules\image\image.admin.inc).
I find the related codes in media_watermark.install:
it needs height defination. I suggest:
Comment #28
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you drupalfan79, will be fixed. It is strange that I didn't get this error.
Comment #28.0
Bogdan1988 CreditAttribution: Bogdan1988 commentedchanged git branch
Comment #28.1
Bogdan1988 CreditAttribution: Bogdan1988 commentedChanged git clone to use non maintainer url
Comment #28.2
Bogdan1988 CreditAttribution: Bogdan1988 commentedchanged formatting
Comment #29
Bogdan1988 CreditAttribution: Bogdan1988 commentedAdded all changes according to comments. Changed doc blocks, added some js fixes, changed "no_watermark" to "add_watermark". Checkbox moved to form bottom.
Comment #30
kscheirerIf that fails for whatever reason please get back to us and set this back to "needs review".
You also have a number of code style issues reported here: http://pareview.sh/pareview/httpgitdrupalorgsandboxbogdan19882036479git.
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #31
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you kscheirer. Image cache actions is a great module, media_watermark does not have such great functionality. The main difference from Imagecache actions (in watermarking) is that Imagecache actions apply watermarking effect to image style (From imagecahe actions readme.txt - Watermark: place a image with transparency anywhere over a source picture.). According to this it means that main uploaded image is not changed, but in case of media_watermark we change uploaded file once while upload. Media watermark try to propose new more easier way to add watermarks. Also if we need only to add watermark and we don't need to use all the imagecache actions functionality we can use media_watermark because it has less code and it has another more intuitive interface.
Comment #32
kscheirerComment #33
dman CreditAttribution: dman commentedAs in #13
Comment #34
kscheirerDoh! Sorry.
Comment #35
kscheirerpathinfo($file_name, PATHINFO_EXTENSION)
instead?t('Are you sure you want to delete %name?', array('%name' => $name)
Looks like a great module! Setting to needs work for the branch issues and number of style issues, but otherwise this is RTBC from me.
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #35.0
kscheirerchanges
Comment #36
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you, kscheirer I made all changes you mentioned above.
Comment #36.0
Bogdan1988 CreditAttribution: Bogdan1988 commentedchanged description
Comment #37
Bogdan1988 CreditAttribution: Bogdan1988 commentedComment #38
Bogdan1988 CreditAttribution: Bogdan1988 commentedComment #39
Bogdan1988 CreditAttribution: Bogdan1988 commentedComment #40
Bogdan1988 CreditAttribution: Bogdan1988 commentedadded one more link to manual review for another project. now made three manual review, thanks.
Comment #41
candotri CreditAttribution: candotri commentedYou have many long lines. In https://drupal.org/coding-standards#linelength there are various conditions where this is ok but, for example, in media_watermark.module:
is what I see. It's much more readable like this:
Other than that I find the code nice and readable. Good work!
Comment #42
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you candotri, will be fixed!
Comment #43
Bogdan1988 CreditAttribution: Bogdan1988 commentedComment #44
kscheirerThanks for those updates! I'm unassigning this issue so that other reviewers know this one is open for final review.
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #45
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you, kscheirer!
Comment #46
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
<script>alert('XSS');</script>
I will get a nasty javascript popup on the overview page. You need to sanitize user provided text before printing, make sure to read https://drupal.org/node/28984 again. Strictly speaking this is not a security vulnerability because the "administer site configuration" permission is required to inject the malicious snippet in the first place, but this should be fixed anyway.Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #47
klausiComment #48
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you klausi. Will be fixed soon.
Comment #49
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you klausi. Will be fixed soon.
Comment #50
Bogdan1988 CreditAttribution: Bogdan1988 commentedAdded all changes according to this comment https://drupal.org/comment/8165937#comment-8165937. Thank you klausi, your manual review helped me to improve media_watermark, thanks!
Comment #51
Bogdan1988 CreditAttribution: Bogdan1988 commentedAdded link to one manual review.
Comment #52
idebr CreditAttribution: idebr commentedHi Bogdan,
Great idea for a module! I have some pointers before you release:
Class MediaWatermark
is only used infunction media_watermark_create_image()
. Instead of including the file in every page request, you can include the class file conditionally with module_load_include() to reduce memory load.db_query()->fetchAllAssoc()
instead offetchAll(PDO::FETCH_ASSOC)
. The docblock suggests it returns an array, but the return value can be empty when the result is empty.$('.hide-select-list')
becomes$('.hide-select-list', context)
. This makes your jquery selectors faster as it only has to search the context element instead of the entire DOM.Keep up the great work, you are almost there :)
Comment #53
Bogdan1988 CreditAttribution: Bogdan1988 commentedAdded one more link to manual review.
Comment #54
Bogdan1988 CreditAttribution: Bogdan1988 commentedAdded third link to manual review.
Comment #55
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you idebr I completely agree with you in these statements in your review:
1) I will use module_load_include();
5) I will also change form to simple page callback;
7) Will use l() functions.
9) will check.
10) will use $('.hide-select-list', context).
But all other seems to me not very necessary.
8-th and 4-th statements are in contradiction;
Thank you idebr for your review.
Comment #56
Bogdan1988 CreditAttribution: Bogdan1988 commentedAdded three manual reviews. Added review bonus tag. Thank you.
Comment #57
klausimanual review:
Comment #58
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you klausi for your review, I read all documents again (https://drupal.org/node/930760, https://drupal.org/node/28984) . I am very sorry that I didn't notice these things. 2-nd and 3-rd are fixed. About 1-st I am not sure because I still use render() to render edit/delete links. I tried to add this array into theme table array but it was not rendered. I tried to find some other solution, but can I use render() there (media_watermark_edit.admin.inc line: 105.)? I leaved comment in code why I cannot put this array as is.
Thank you for your help.
Comment #59
Bogdan1988 CreditAttribution: Bogdan1988 commentedMade changes into css file to prevent pareview.sh notices.
Comment #60
basant CreditAttribution: basant commentedComment #61
Bogdan1988 CreditAttribution: Bogdan1988 commentedComment #62
basant CreditAttribution: basant commentedYou have done a great job and very near to the goal.
I have used a fresh drual installation to test your module and it worked, but only with media upload option, drupal default image option did not worked for me and if this is the case then please chagne the description from
"Media watermark module allows to add watermark to image files (.jpg, .jpeg, .gif, .png) while they are uploading into CMS"
to
"Media watermark module allows to add watermark to image files (.jpg, .jpeg, .gif, .png) while they are uploading into CMS through media module".
Manual Review: media_watermarks.install file- line no 105, is blank line, it can be removed.
- When we unistall module, entries created by code on line 96
- Just a suggestion, on line number 28, you can remove dot before png and gif.
- On line number 79, you have used system_settings_form, it is used when we need to submit form automatically and is used with variable_get and variable_set, for more info please visit Drupal Api Page
- On line 95 and 102, in form set error, my suggestion will be to replace "20 character" by "20 digits" as you are expecting integer and it would be better to check for integer first and then for length.
- Just a suggestion, on line 130 you have used
- In file media_watermark_delete.admin.inc on line 21, you dont need to define $form['#submit'], it will automatically submit to media_watermark_delete_form_submit() as I explained above.
$file_temp = file_save_data($file_temp, 'public://watermark' . $value['file'], FILE_EXISTS_RENAME);
are still there in database (in file_managed table). Following link may help you in deleting those data,
https://drupal.org/comment/7295942#comment-7295942
Manual review for media_watermark_add.admin.inc
You just need to add Submit button at the end and you should remove line 76 and 77 where you have defined validate and submit function. Drupal automatically calls form_id_validate and form_id_submit when form is submitted, so your validate and submit functions will be called automatically as you have followed the correct naming convention for submit and validate function.
file_usage_add($file, 'media_watermark', 'image', $user->uid);
it would be better to use wid from your table instead of $user->uid, but not a road blocker.
Comment #63
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you basant.
Comment #64
Bogdan1988 CreditAttribution: Bogdan1988 commentedComment #65
Bogdan1988 CreditAttribution: Bogdan1988 commentedMade changes according to basant review.
Comment #66
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
But otherwise looks RTBC to me.
Assigning to kscheirer as he might have time to take a final look at this.
Comment #67
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you klausi. Issue is fixed in this commit http://drupalcode.org/sandbox/Bogdan1988/2036479.git/commitdiff/0d0b8ce?.... thank you!
Comment #68
klausino objections for more than a week, so ...
Thanks for your contribution, Bogdan1988!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #69
Bogdan1988 CreditAttribution: Bogdan1988 commentedThank you all for your reviews and help in improving project!
Comment #70
Bogdan1988 CreditAttribution: Bogdan1988 commented