News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

How to add picture ? Please check the image

Started by user555, August 16, 2015, 10:43:33 AM

Previous topic - Next topic

user555

Actually i was trying to share my new website on Facebook!
While sharing my web,it isn't showing any picture beside & if i try to share any other web it will show up a picture along with the website name.
Sorry, i m new and can't clarify my problem, as i don't have any idea what that thing called ,! Kindly please check out the pic. i attached,i hope u get it what am i trying to say...

Thanks

Kindred

Well, to have an image in a web share on Facebook, you need to either have an og:image defined or you need to have an image on the page...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

user555

Thank you for you kind reply :)
how can i add that image and the code for it ?

Kindred

Well, you would have ANY image on the page at all....   Or look up the instructions on how to assign og:image values... Or install one of the social media mods
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

user555

Okay, got it, but i can't find the header.php in theme .
I need to put the code there i think

JBlaze

Look in your theme's index.template.php, which is located in /Themes/{theme}/index.template.php

There you will find the <head> tags where you need to put your <og> tags.
Jason Clemons
Former Team Member 2009 - 2012

user555

not working, can't do it :(
everytime it's showing up an error, not possible for me, i dont know anything
anyway thanks once again

Deaks

what exactly you trying to add please show full code
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

user555

I am trying to add thumbnail image, so that when I share a link in Facebook it will show up an image along with description of the website.

Added this code in  /Themes/Gearbox/index.template.php :

<meta property="og:title" content="<?php echo osc_item_title() ; ?>" />
    <meta property="og:description" content="<?php echo osc_highlight(strip_tags(osc_item_description()), 140) ; ?>" />
    <?php if( osc_count_item_resources() > ) { ?>
        <meta property="og:image" content="<?php echo osc_resource_thumbnail_url(); ?>" />
    <?php } else { ?>
        <meta property="og:image" content="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" />
    <?php ?>


images/no_photo.gif'  -- this part i changed to images/og.png (added a og.png image in images folder)

But everytime it showing up an error, something wrong in line number 77 , php error
I am really bad in coding, don't have any idea, just trying to make a gaming website for our clan.

Kindred

you can't add that code in the middle of a template...

first and foremost, SMF files are **ALL** php.
That means that the php open is defined at the start of the file and closed at the end of the file.
-- so your <?php ... ?> is just plain wrong....  that is the sort of coding that wordpress and joomla use... not SMF.

second, because of the first comment, your code has to be re-written to be a single echo statement, not html mixed with echos
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

user555


Kindred

hmmm.....   I'm not sure that code can be directly translated to the correct format....

can we include function calls in the middle of an echo statement?


What are these functions?   They are not part of SMF...

osc_item_title()
osc_highlight()
osc_item_description()
osc_resource_thumbnail_url()
osc_current_web_theme_url()

without those functions being defined, even the corrected code won't do anything.

I think that code is actually complete BS and pointless -- it looks like you grabbed a code snippet form some other system...


What, EXACTLY, are you trying to do?
What do you want on each page for the og:title, og:description, and og:image?


Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

user555

When i share my link of my website(howitworks.comze.com) on facebook, i want it to show a thumbnail image and description!

Suppose i write http://www.simplemachines.org on facebook , its showing Simple machine forum logo and description (Simple machine forum - Free & open source community software .......)
I want the same for my website, it should show logo as well as description .
howitworks.comze.com : its showing only the name of the website,community name but no thumbnail picture and description.

Deaks

we know this what I am sure Kindred is asking is what are you trying to do with that code, where did you get it? etc
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

user555

i found d code somewhere within this forum, searched in google and in a thread(years before), someone had d same query and he/she posted that code..
I'm not sure what that code does, all i did is copied the code & pasted it in /Themes/{theme}/index.template.php , and then it encountered an error, and later on i deleted that code as it didnt worked.

Deaks

~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Kindred

I have no idea where you found that code... but, as it is, it will not work with SMF at all ---   as I said above, that code is not designed for use in an SMF template and requires functions which are not part of SMF...

So,
you just want a single, generic image for any page shared from your site?
You want the description and title of the page to match the description and title of the page shared?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

user555

Quote from: Poύνικ on August 18, 2015, 02:09:13 PM
Quote from: Kindred on August 17, 2015, 02:40:01 AM
Or install one of the social media mods

really simple answer right their!

The mod isn't working with d version of smf i m using. Test unsuccessful.



This is the thread from where i got the code..

&&&&&& SORRY SORRY !!!!!!!!!! I thought its from smf web, lol the theme, i was wrong, luks d same, d code is from other website ! SORRY

[nofollow]
Quoteyou just want a single, generic image for any page shared from your site?
Yes. i will add an image in the image folder(maybe a logo) and that logo should show(as thumbnail) when posting my website link on facebook.

QuoteYou want the description and title of the page to match the description and title of the page shared?
Yes, exactly !!!!!!!!!

Just like when sharing smf web ! i want something like dat :)

Deaks

Quote from: user555 on August 18, 2015, 02:07:25 PM
i found d code somewhere within this forum.

Quote from: user555 on August 18, 2015, 02:59:34 PM
http://forums.osclass.org/3-2-x/help-needed-no-thumbnail-image-when-i-share-a-link-in-facebook/
This is the thread from where i got the code..

please note how osclass does not say simplemachines

What version of SMF are you using?
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

user555

Yes Yes SORRY ! the theme luks alike, so i mistook it as smf !!!!!! SORRY

i m using version 2.0.10

Advertisement: