Upload Images using Blogger Post Image API - php

Is there any way to upload images using blogger API? (https://developers.google.com/blogger/docs/3.0/using)
I have a web developer who is going through trouble to integrate Blogger API for uploading images to my site. I thought if I could be of any help at all to him.
Normally using Picasa the images upload to googleusercontent like this :
Link to a picasa image
But what I want is for it to be uploaded to this :
Link to a image uploaded from Blogger post
The developer is using PHP. I tried searching many sites but with no luck for a working version.
Any help is appreciated thanks.

The images uploaded to Blogger directly via the website (having the URL format of x.bp.blogspot.com) are also saved on Picasa behind the scenes.
The domains used by these images (like lh3.googleusercontent.com, 3.bp.blogspot.com ,1.bp.blogspot.com,2.bp.blogspot.com,4.bp.blogspot.com) are interchangeable in nature and all of them serve the same image.
For example, the image that is using the googleusercontent URL (For testing purpose, I uploaded an image using the Official Blogger Android app) -
https://lh3.googleusercontent.com/-VESDEmEh7EM/WpCZ_8qD_wI/AAAAAAAAYs0/XDWkxkEz7EUrGUBmpTSEKBGiynGrEKOygCHMYCw/s640/1519426035853.jpg
Can also be accessed by using bp.blogspot.com URLs, like -
https://4.bp.blogspot.com/-VESDEmEh7EM/WpCZ_8qD_wI/AAAAAAAAYs0/XDWkxkEz7EUrGUBmpTSEKBGiynGrEKOygCHMYCw/s640/1519426035853.jpg
If you still want to exclusively use the x.bp.blogspot.com format URLs for images in the Blog post, you can write a custom logic in your PHP application to replace all references of lh3.googleusercontent.com (that you got after uploading the images via Picasa API) with x.bp.blogspot.com URLs before creating the post via the API)

Related

API Blogger - Display image on mobile

I've got a problem by using the Blogger API in PHP. When I publish an article with a picture on Blogger by using API, the picture appeared correctly on desktop version of my blog but no on mobile.
For example:
I send the following article on Blogger
<p><img src="https://cdn.pixabay.com/photo/2018/10/03/21/13/mushroom-3722395_960_720.jpg" /></p><p>Test</p>
On the index of my Blogger on Desktop, the pictures are correctly displayed:
Index Blogger on Desktop
I open the same page on mobile, and all pictures have disappeared:
Index Blogger on Mobile
I noticed that URL generated by Blogger are differents on mobile and desktop.
By inspecting element, the URL on mobile is exactly the same that I've sent thanks to the API (ie: https://cdn.pixabay.com/photo/2018/10/03/21/13/mushroom-3722395_960_720.jpg).
On desktop, the URL is totally different:
https://lh4.googleusercontent.com/proxy/...
If I edit the post directly on Blogger and if I replace the original URL (https://cdn.pixabay.com/photo/2018/10/03/21/13/mushroom-3722395_960_720.jpg) by the URL generated (https://lh4.googleusercontent.com/proxy/...), the picture appeared correctly on mobile!
Have you got an explanation? How I can display pictures on mobile by using this API?
Your blog uses two templates now one for desktop and other for mobile. The mobile template is one of old default blogger mobile templates which allow showing images that hosted on blogger only. Images hosted on blogger can be easily resized by change some values in image URL, that cannot be done with images hosted away off blogger.
Now you have to change mobile template and aplly the desktop template to cover both desktop and mobile.

LinkedIn share API issue

I am making an app in order to post an image to LinkedIn.
The problem is that it's not working for images.
I use my uploaded image URL in submitted-image-url in order to post my image with a caption but unfortunately, it just uses a thumbnail of my image.
What can I do to post my image? By the way, I use PHP.
Currently, as of May, 2020, LinkedIn only supports the url parameter in its share URL. So, you'll have to share the image by making it a linkable file and then share the URL to the file, like so..
https://www.linkedin.com/sharing/share-offsite/?url={url}
Source: Microsoft LinkedIn Share URL Documentation.
If you are interested in a regularly maintained GitHub project that keeps track of this so you don't have to, check us out! Social Share URLs

How can I publish an image from url with Twitter API?

I'm trying to publish an image from URL with Twitter API and PHP but I can't do it.
I have seeked in many post but I could find only how to upload an image.
Is possible to do it?
As you have discovered, this is not possible.
One way around it is for you to download the image first, and then upload it.
For example
file_put_contents("temp-img.jpg", file_get_contents("http://example.com/flower.jpg"));
Then, using whichever Twitter library you have, you can post temp-img.jpgdirectly.

Accessing Photos from Posts in Google + using API?

I am trying to build a server side application (PHP) which can download photos that has been shared with me in Google +, but I couldn't find a method in Google+ PHP Client Library for this. I tried to get it through PicasaWeb API, but the Album 'Photos from posts' is not listed when trying to get the list of all albums.
Please suggest some way to do this.
Fetch the posts themselves. In there will be the URLs for the photos that you can then fetch to get the actual images.
Note that there are "resize" tags in the image URL path so if you see something like .../s2048/... or .../w497-h373/... then that will instruct G+ to give you a smaller version (which greatly reduces bandwidth and latency over requesting the full-size image and scaling it locally). Just remove that component of the path to get the full-size image.

Using Flickr to Enable Images on a Site

Has anyone had success using Flickr to embed images that users can upload to my site, but that are hosted on Flickr?
Is something like this possible?
Thanks,
Alex
There is a flikr upload API:
http://www.flickr.com/services/api/upload.api.html
Have them upload their photos to your site, you can crop it or re-size it programatically with GD or imagemagick as needed, then use the flikr upload API to put it on your flickr account, then delete the original to save space, then embed it on the site.
This will save space for you. While also preventing your users from needing to get an account on another site, or having to leave your site to post photos, or figuring out how to link them back.

Categories