Adds a "Credit" field when uploading media to posts and displays it under the images on your blog to properly credit the artist.
- PHP 7.4.0 or above
- WordPress 5.9 or above
Adds a "Credit" field when uploading media to posts and displays it under the images on your blog to properly credit the artist.
License: GNU General Public License v2.0
Use minified versions of resource files:
From https://wordpress.org/support/topic/media-credit-doesnt-display-if-no-caption-present?replies=16
Currently the HTML output for "plain" [media-credit] cannot match [caption][media-credit][/caption], resulting in a different user experience depending on the presence of a caption.
Adding a mass import of credits via a CSV file (or something similar) would benefit sites with a huge number of media.
Enhancement request based on https://wordpress.org/support/topic/mass-import-2
The TinyMCE integration needs to be updated to the latest Core release.
First reported in the WP support forums.
Currently, there are no unit tests at all. This has to change soon.
When a user without the necessary permissions to change the credits, the input fields should be marked as read-only. Currently, it looks as if the user could overwrite the credits (but he call fails on the backend).
First reported in the WP.org support forum.
Update jQuery usage for jQuery 3.5.1 shipped with WordPress 5.6.
Scrutinizer-CI and Travis-CI are outdated and/or have changed TOS for the worse.
When no_default_credits
is enabled and the entered credit string is identical to the display_name
of a user (or rather: the current post_author
of the attachment), that string is not saved.
First reported by Aaron T. Grogg in https://wordpress.org/support/topic/credit-and-credit-url-disappear-in-overlay-view-but-works-in-page-view/
Requested via the WordPress support forum.
From the WordPress support forums (on WordPress 5.5.1):
When I insert an image into my page using the Add Media dialog, and then manipulate its properties from the context menu which results from clicking the image, the resulting markup isn’t a shortcode, but what appears to be temporary markup, ie:
<div class=”mceMediaCreditOuterTemp alignnone” style=”width: 721px”><span class=”mceMediaCreditTemp mceNonEditable” data-media-credit-text=”credit text” data-media-credit-align=”alignnone” data-media-credit-link=”credit.com”>credit text</span>…</div>
When I click “Add Media” and add the Credit & Credit URL values in the image properties dialog in the sidebar, then the resulting shortcode does get generated properly, ie:
[media-credit name=”credit text” link=”credit.com” align=”alignnone” width=”638″][/media-credit]
Steps which produce the error:
In Visual Mode, click “Add Media” button to invoke media overlay
The resulting markup is html, instead of a shortcode.
Steps which don’t produce the error:
The resulting markup is a shortcode.
Currently, there's a filter hook for the shortcode output, but not for the markup used in the Block Editor (Gutenberg) integration.
Requested via WordPress support forums.
Moved from https://wordpress.org/support/topic/prevent-setting-default-credit:
Having default credits show up on the backend even when disabled for the frontend is confusing for users.
Add a way to mark external links as "no-follow":
Optionally append credit to caption (in figcaption).
Import & push tags/releases from SVN
When default credits are disabled, Gutenberg core/image
blocks include credit markup even when the credit string itself is empty. See this post in the WordPress forums for the initial report.
Reported via the WordPress.org support forums:
Since version 4.0.0, when the plugin is active, I cannot upload any Media using the Add Media button within Edit Post (post creation or post edit). I get the following error in the Google Chrome console:
Uncaught TypeError: Cannot read property ‘placeholder’ of undefined
at eval (eval at s.template (underscore.min.js:1), :7:26)
at i (underscore.min.js:1)
at wp-util.min.js:1
at N.d.template (media-credit-attachment-details.min.js:3)
at N.d.render (media-views.min.js:2)
at N.d.render (media-credit-attachment-details.min.js:3)
at wp.Backbone.Subviews. (wp-backbone.min.js:1)
at underscore.min.js:1
at Function.s.each.s.forEach (underscore.min.js:1)
at wp.Backbone.Subviews._attach (wp-backbone.min.js:1)
Hi there,
I was wondering if it is possible to set a default media credit string or to overwrite the existing logic via a filter or such since the default always reads "User SEPARATOR Organization" and we would like to be able to just have it always read X by default and then we can set it differently if need be...
Any chance of hooking into that?
Thanks!
Add an optional "short form" for the Show credits at the end
line. Requested multiple times in the WP.org support forums.
The 'add_media_credit' function that builds the input fields for the media editor automatically adds the media uploaders name to the credit line. This is problematic when you do not want to provide credit to a specific media asset, but do want to make an adjustment to something like Yoast SEO values or Alt/Description tags. You have to manually clear the credit field out since it is pre-populated.
I made the following update to add_media_credit on my end, which seems to make a bit more sense to me.
$credit = get_freeform_media_credit($post);
$credit_user = get_wpuser_media_credit($post);
$html = "<input id='attachments[$post->ID][media-credit]' class='media-credit-input' size='30' value='$credit' placeholder='$credit_user' name='attachments[$post->ID][media-credit]' />";
Basically, I pull the freeform credit, and use that for the input value, and then use the wpuser as the placeholder. This shows the uploader in 'grey' (by default), and if the 'do not display default credit' option is unchecked, this is what will appear.
Enhancement request based on https://wordpress.org/support/topic/add_media_credit-doesnt-obey-include-default-credit
Changes to nofollow
flag are not saved when editing images in the legacy Media Library view.
The PHP version check (and 5.2 compatibility) is obsolete now that proper PHP validation is in Core. The minimum WordPress version needs to be raised to 5.2.
Look for recent changes to the wpeditimage
TinyMCE plugin.
https://wordpress.org/support/topic/mcemediacreditoutertemp-divs-appearing:
But one of the editors is having an issue with images that don't have a media credit or caption. Placing the image on the page seems to work just fine. But going back and then editing the image results in the image (and sometimes the headline gets thrown in there too) being wrapped in this div code that messes with the layout:
<div class="mceMediaCreditOuterTemp alignright" style="width: 250px;"></div>
From the WordPress support forums:
For images with credits applied, when adding breaks, instead of the breaks appearing below the image, it instead appears above. The behavior is unlike what you’d normally get with e.g. the regular caption.
Screencapture example:
https://gyazo.com/8e08b2742b257e27eb4e3fb016539d55
Reported via mail by Matthias Jung.
Include a proper CHANGELOG.
Use a "scoping" package to change dependency namespaces to prevent incorrect dependency versions (from other WordPress plugins) from being loaded.
schema.org markup for http://schema.org/ImageObject should be added to the shortcode output.
Enhancement request based on https://wordpress.org/support/topic/wrap-in
All @since 3.3.0
annotations should be changed to @since 4.0.0
Due to a typo, handling of malformed shortcodes has been broken since 3.0.0. First reported in the WP.org support forums.
Reported in the WordPress support forums.
The media credit can probably be added to featured images via the post_thumbnail_html
filter.
The value range for the align
shortcode attribute has been changed. Instead of align="align left"
the new syntax is align="left"
. The old attribute values should be silently upgraded, though.
First reported in the WordPress support forums:
The placeholder text used when the default credits are disabled should be customizable. Using the post author can be confusing for users.
Reported by @ctbritt in the WordPress support forum.
Option "No default credits" is not honored Featured Image credits.
From https://wordpress.org/support/topic/credit-in-featured-image
Probably only for blocks (core/gallery
).
Requested in the WordPress.org support forums.
Create template API accessible via Media_Credit
and deprecate the old global functions.
If I press save on the page: /wp-admin/options-media.php#media-credit, the following errors appear:
`
Notice: Array to string conversion in /home/abcde/public_html/wp-includes/formatting.php on line 1025
Notice: Array to string conversion in /home/abcde/public_html/wp-includes/formatting.php on line 1025
`
Wordpress 4.6
Media Credit 3.1.1
See https://wordpress.org/support/topic/credits-for-cropped-images/ for details.
Hey,
thanks for this plugin!
it would be nice if this plugin get self registered to the REST API Media endpoint
eg: url.com/wp-json/wp/v2/media/anynumber
So we can deliver instantly the credits with the media.
For me i found this solution for theme/function.php
add_action('rest_api_init', 'tb_add_custom_rest_fields');
function tb_add_custom_rest_fields() {
// schema
$media_credits_schema = array(
'description' => 'Copyright of the media item',
'type' => 'string',
'context' => ['view']
);
// registering the field
register_rest_field(
'attachment',
'media_credits',
[
'get_callback' => 'get_media_credits',
'update_callback' => null,
'schema' => $media_credits_schema
]
);
}
function get_media_credits($object, $field_name, $request) {
//return 'this-is-a-test';
return array(
'copyright' => get_media_credit(),
'copyright_url' => get_media_credit_url(),
'copyright_html' => get_media_credit_html(),
);
}
This will add fields like this
...
"media_credits": {
"copyright":"© test",
"copyright_url": "http://www.google.de",
"copyright_html": "<a href=\"http://www.google.de/\">© test</a>"
},
...
Thanks for the plugin and reading!
I hope you are able to add this feature in near future.
Because of all the headless CMS trends it would be nice.
regards
dnl
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.