0

my question a little complicated.

I want to share a featured image which is in a post on my wordpress site to twitter.

But there a important point. i want to share a picture with twitpic because of people can see this image in twitter without open my web site.

i get api from twitpic, and i use this code (link)

but twitpic or this code cannot accept a url to upload twitpic and get a link.

$resp = $twitpic->upload(array('media'=>'$a2', 'message'=>'get_the_title()'));

if i wrote $a2 = "ex.jpg" its working, if i wrote $a2 = "http://www.ex.com/ex.jpg" not working

then i try that;

    <?php
$a1 = $_SERVER['DOCUMENT_ROOT'];
// ex image remove 18 chr from begining http://*******.com/wp-content/uploads/2013/04/2012-10-17-23.48.34.jpg
$kisalt1 = $imageshare[0]; // wordpress featured image fxn ex: http://*******.com/wp-content/uploads/2013/04/2012-10-17-23.48.34.jpg
$kisalmis = substr($kisalt1,18,9999);
$a2 = $a1.$kisalmis;
// echo $a2;  =>  /home/*******/public_html/wp-content/uploads/2013/04/bu-terste-bir-islik-var-panpa.jpg
?>

but it stil give same error.

Unable to find or read file

how can i get ride of this?

summary => i want to this => wordpres featured image to twitpic for share twitter like image which can open without click a link.

1 Answers1

0

Edit: I just tried deleting this because I saw that you said that http://www.ex.com/ex.jpg doesn't work for you. But then I thought this might still be helpful (to someone), and for some reason the comments option didn't show up for me, so here it is again. Sorry if it doesn't help though.


What you need is just the post_thumbnail url, not the full image tag.

http://wordpress.org/support/topic/getting-post-thumbnail-url

The relevant post is the one with this code block:

$a2 = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );

Does it work if you add that?

-Andrew


Another edit...I just came across this post on the Wordpress StackExchange site: https://wordpress.stackexchange.com/questions/83137/post-thumbnail-relative-link-and-html-modify

Does it work if you provide TwitPic with a relative link location?

Community
  • 1
  • 1
acsmith
  • 1,466
  • 11
  • 16
  • i use seo links so www.example.com/post/post-title/ i cannot add to $a2 = "../../wp-content/uploads/2013/04/image.jpg" its not working. – Mervan Cantürk Apr 16 '13 at 12:16
  • what would the actual URL of your image be? Do you have the whole thing in a "Wordpress" subdirectory, or is it in your base public_html directory? – acsmith Apr 16 '13 at 12:24
  • www.example.com/wp-content/uploads/2013/04/1235421234.jpg or something like that. classical wordpress media ? i tried 3 types for $a2 – Mervan Cantürk Apr 16 '13 at 12:29