Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Add support to specify a default image that will be used in the event that a node does not have an image of it's own.
Comment | File | Size | Author |
---|---|---|---|
#34 | opengraph_meta-show-original-image.patch | 567 bytes | tamer.kamel |
#26 | opengraph_meta-forcefallback-1006888-27.patch | 3.55 KB | fmitchell |
#24 | opengraph_meta1006888.common.patch | 1.3 KB | jlea9378 |
#24 | opengraph_meta1006888.admin_.patch | 1.45 KB | jlea9378 |
#23 | opengraph_meta.admin_.patch | 1.42 KB | jlea9378 |
Comments
Comment #1
axe312 CreditAttribution: axe312 commented/signed
and please add support that the default image can be ALLWAYS taken instead of cck field-image
thank u :)
Comment #2
hiddentao CreditAttribution: hiddentao commentedI could add a field to the Open Graph admin pages which allows you to specify a default image to use for all nodes which don't have an image of their own. Will this do?
Comment #3
axe312 CreditAttribution: axe312 commentedYeah that would be awesome!
Please also add a checkbox where the admin can choose if that image is allways taken or only when the node has no image.
thx :)
Comment #4
jlea9378 CreditAttribution: jlea9378 commentedI'm interested in this feature also. =)
Comment #5
thewoodm CreditAttribution: thewoodm commentedI would also LOVE to see this feature. The implementation suggestion in #2 would be perfect.
Comment #6
hiddentao CreditAttribution: hiddentao commentedComment #7
hiddentao CreditAttribution: hiddentao commentedI've added a simple text field to the admin screen in which you can specify the URL to a fallback image you can use in case if the node doesn't have an image attached (or in its body). I did consider allowing for an image to be uploaded but I didn't want to restrict it that way - with the text field solution you can use any image from anywhere.
@axe312 I've assumed for now that if a node doesn't have an image of its own to use then the fallback image will be used. If enough people want the checkbox added in I can do that too.
Comment #8
hiddentao CreditAttribution: hiddentao commentedComment #9
jlea9378 CreditAttribution: jlea9378 commentedThe default image seems to work great except if you override it on a node it seems to still use the default image.
What we (at my organization) want is that it always uses the fallback/default image unless someone overrides it on a specific page. I'm not sure if that was your original intention with your proposed solution or not?
Thanks for working on this!
Comment #10
jlea9378 CreditAttribution: jlea9378 commentedComment #11
hiddentao CreditAttribution: hiddentao commented@jlea9378 It definitely shouldn't be doing that. If you set an image specifically within a node it should use that image rather than the default image. Are you sure you've selected a specific thumbnail in your node to be the og:image?
Comment #12
jlea9378 CreditAttribution: jlea9378 commentedYup. The radio button beside the image under "Open Graph meta tags (e.g. for Facebook sharing)" "Thumbnail Image" is filled and I saved. But it still uses the default image.
Unless the fact that it can't find the image is part of the problem? This is what it is trying to load next to the radio button: http://sites/default/files/images/5052740428_f6687f5c9c_s.jpg
Comment #13
el_reverend CreditAttribution: el_reverend commentedI can confirm jlea9378's comment, that the default or fallback image will always be used even when assigning an image from within the node (in my case a custom blog post).
I have also noticed that the Fallback Image will not show up in Facebook with either a relative or absolute path. The specified image path however is present in the HTML og:image tag, and is accessable directly via URL. This may be a problem on FB however.
Comment #14
jlea9378 CreditAttribution: jlea9378 commentedFound a problem with the default/fallback image. It seems to stop working if you change the URL of the image. We recently changed our logo so I had to change the URL in the Default/Fallback Image field and it caused the wrong images to be sent to facebook. I looked at the og:image tag on some of the pages and it was using the images off the pages in most cases.
Completely uninstalling and reinstalling the module seemed to fix it.
Edit: However on pages that I previously had clicked to "Share on Facebook", facebook brought up the old image even though the og:image tag said to use the new image. Checking the page via the Facebook Linter (http://developers.facebook.com/tools/lint) fixed it and made it load the new image. I suspect this is caused by facebook caching the image for a given URL.
Comment #15
jlea9378 CreditAttribution: jlea9378 commentedStill seems to be some issues with this. Sometimes the fallback image isn't being used even though it should be. As far as I can tell this page should be using the fallback image but it's not. The og:image tag shows a different image.
http://www.clatsopcc.edu/about-ccc/press-releases/congratulations-year-s...
Comment #16
kurth CreditAttribution: kurth commentedGreetings everyone!
I had a client requirement to force the "Fallback Image" to be displayed regardless of any other images available in the node. So I did just that and am sharing with you. :]
This patch adds a checkbox under the "Fallback Image" field, allowing the user to force the use of the fallback image regardless of other images available.
This patch was developed for Koumbit.org
This is my first contribution, so your constrictive feedback is appreciated.
~k
Comment #17
jlea9378 CreditAttribution: jlea9378 commentedI checked the box on the Open Graph Meta settings page to always use the Fallback Image. When viewing a node, I got this:
warning: Missing argument 2 for OGMDrupalSettings::get(), called in /var/www/html/drupal_test/sites/all/modules/opengraph_meta/opengraph_meta.common.inc on line 148 and defined in /var/www/html/drupal_test/sites/all/modules/opengraph_meta/opengraph_meta.common.inc on line 361.
Comment #18
lyricnz CreditAttribution: lyricnz commented#17: you need to modify line 148 of opengraph_meta.common.inc - add a FALSE to the end of the function call
Comment #19
jlea9378 CreditAttribution: jlea9378 commentedThanks, that fixed it. The patch (with the fix in #18) seems to work great. I tested it on a dozen or so pages and the correct image was sent to facebook every time.
Comment #20
kurth CreditAttribution: kurth commented@lyricnz Thank you for picking that up. :]
I've attached a new patch, with the change implemented in #18
Thank You.
Comment #21
jlea9378 CreditAttribution: jlea9378 commentedSeems to work great with the patch in #20. I just applied it to the latest dev release and tested it on a bunch of pages on my site.
Comment #22
hiddentao CreditAttribution: hiddentao commentedThat's great on the 'always force fallback image' work. If there's enough demand for this I can put this into the next release. Or better yet perhaps a hook can be added to the tag rendering function so that anyone wanting to override tag output values can simply intercept that hook.
Comment #23
jlea9378 CreditAttribution: jlea9378 commentedAttached are patches to add kurth's force feature to the module in drupal 7.x-1.x-dev. Sorry I don't know how to make a patch using cvs, so it's just a diff from my filesystem.
edit: Not sure why it is giving Page Not Found...
Comment #24
jlea9378 CreditAttribution: jlea9378 commentedReposting. This is for 7.x-1.x-dev:
Comment #25
bkosborneCan we get these commit? This is a great feature, being able to specify a specific the node use the default instead of one from the fields.
Comment #26
fmitchell CreditAttribution: fmitchell commented@24 patch didn't work for me.
We needed on more component to check as it will set the pulled image if it already exists. Coincidentally, when I updated my module to 7.x-1.x, an alter hook was called, so this patch really isn't needed. I"m attaching it anyways since I only found the alter after the fact.
This patch includes @24, so you should only need this one.
Comment #27
jlea9378 CreditAttribution: jlea9378 commentedI installed the latest Drupal 7 dev release (May 20th) and applied the patch in #26. It worked great. I would love to see this patch included in the next dev release.
Comment #28
jlea9378 CreditAttribution: jlea9378 commentedI installed Open Graph meta tags 6.x-1.x-dev (2012-May-19), however the patch in #20 no longer works. It looks like part of the patch might already be implemented in this latest dev release, however not all of it is. Specifically, the option to force the fallback image that appears on the admin ui is missing.
Comment #29
jlea9378 CreditAttribution: jlea9378 commentedI was getting an error when I attempted to update one of our pages that has 4 images on it, stating that my selection was invalid. This error was referring to the Opengraph Meta image selection. It was harvesting the images and showing the 4 images as selections, despite the Force Fallback being enabled. I took a look through the code and noticed that the patch does not change any of the code in opengraph_meta.module. It looks to me like some changes are needed in this file in the opengraph_meta_form_alter function. The following changes seem to work for me.
Before:
After:
Comment #30
lyricnz CreditAttribution: lyricnz commentedFYI http://drupal.org/project/metatag project appears to be better maintained than this, and offers a more general solution to the problem. I've switched my D7 sites, at least, to using this - and it works great.
Comment #32
torotil CreditAttribution: torotil at more onion commentedClosing as fixed due to the commit mention.
Comment #34
tamer.kamel CreditAttribution: tamer.kamel commentedYou can replace the thumbnail by the original image by this patch.