I retrieve photos from home with this graph API request https://graph.facebook.com/me?fields=home.filter(photos).
Then via the object ID I retrieve the images array that gives me different sizes like this :
"images": [
{
"height": 780,
"width": 1240,
"source": "https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-prn2/281028_10151592859979158_562775226_o.jpg"
},
{
"height": 81,
"width": 130,
"source": "https://fbcdn-photos-g-a.akamaihd.net/hphotos-ak-prn2/s75x225/969715_10151592859979158_562775226_s.jpg"
}
Is it possible to retrieve the originally posted image ?
The image retrieved has to have the same checksum then the image posted
That's no 100% guarantee checksum is same, don't do that. Why? Because if you upload a .gif or .png image, Facebook would do conversion to become a jpeg image instead. So even though you upload a 1920*1280 .png image, what you can get is the modified version 1920*1280 .jpeg image. I have no idea facebook database would keep original image or not, but it's not what you can do using Facebook API.
I don't think you can get the exact, same image by the checksum that you uploaded to their servers. I would think that Facebook modifies them into certain formats so that the photo experience is consistent across the whole site.
That said, they could be keeping a copy of the original photo that was uploaded. But as far as getting access to it via the API or any other way, my best guess is looking at the 'source' according to the Facebook documentation on the Photo object:
The source image of the photo - currently this can have a maximum width or height of 720px, increasing to 960px on 1st March 2012
You can fetch it via the API by:
/<photo id>/?fields=source
Sorry it's not an exact answer, but I hope it helps.
Related
I have a website that is going to host thousands of images. Not only that, but each image has different size depending on where you are in the webpage - on the list page, the image is shown as 350x200 rectangle, on the sidebar pictures are 100x100 etc.
So when a user uploads an image to the website, I keep the original and make 4 resized copies for each size. So if 100 users upload an image, the result will be 500 images. I can't event think of what will happen with the different sizes of the different mobile devices...
I started using CloudFront to optimize speed. And when a user uploads an image I upload the original and the resized copies to Amazon S3 bucket.
But if tomorrow I decide to add another size, or change an existing size I have to run a script that deletes the old sized images and to uplaod the newly sized images, which means "get the original from S3, resize it, upload the new size". That is not practical at all. Imagine when I do a complete redesign of the website and the image sizes change completely, I would have to run a script that resizes each image to the new requirements and to delete the old images.
Is there a more practical way to acheive that?
I wanted to acheive the following scenario:
When the user uploads an image, I resize it and upload it to S3
CloudFront will take the images which are directly resized
When I add another size, I want CloudFront to see that this size is missing on S3 and pull it from an origin from my website.
I cannot think of a way to implement this. Any help or sharing best practices will be appretiated.
Rather than doing all this yourself, you could use an image resizing service such as:
Cloudinary
Imgix
They can resize images on-the-fly so you do not have to create and store them yourself. They can also manipulate them (rotate, watermark, colorize) images on-the-fly. Videos too!
If you choose not to use such a service, you could create your own virtual resizing service. The major choice is whether to:
Resize on-the-fly (using CloudFront for caching but not requiring any storage of the resized images), or
Resize upon request and store the result for future access (less processing cost, but involves storage cost)
It is not possible to have CloudFront "see that this size is missing on S3 and pull it from an origin from my website". (You might be able to do fancy stuff with 404 pages, but it wouldn't be worth the effort.)
For anyone doing this now. It's not for everyone, but due cost-saving efforts we just switched from Imgix to using AWS's Serverless Image Handler. Works great if your images are on S3 and maybe a good alternative solution if it lacks the features of Imgix.
Dear fellow community!
Does anyone know how to get the photo files in original size from Instagram? They surely store original files in full size, since you can upload a photo via app to your IG profile, delete it from the phone, and it still syncs your IG with phone library to get this photo back in full resolution.
Their API supports fetching up to 1080x1080px, plus I found this method via Chrome developer tools: http://www.dailydot.com/debug/instagram-high-quality-photos-download-google-chrome/. Script that could do it doesn't seem reliable on large scale, so I'm still looking for a automated better solution.
Please share any experience that could help.
Try to change 640 to 1080 and remove sharpness like in my example:
str_replace(array("s640x640","sh0.08/"),array( "s1080x1080",""),$img['standard_resolution']['url']);
all photos on instagram have real image url (except profile picture image), you just need get access instagram api, decode json result then get real url image.
you can see my example code for search tag using instagram api : http://pastebin.com/fMu7w808
Sorry to say, but the code on the pastebin will not work correctly for this purpose. Standard_resolution does not display the representation for original size of posted media.
$url = $datas->images->standard_resolution->url;
Will yield the following result, while the original image that was uploaded is 1080px wide. (Following is an example, not a working link)
"standard_resolution": {
"url": "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/14613148_236279861425099_8741797152912868864_n.jpg?ig_cache_key=MTX3ODU5Mjg5NDY4NDEEN3E0CA%3D%3D.2",
"width": 640,
"height": 334
}
The trick is to replace the s640x640 part in the url, thus adding the next line in order to get the url of the picture as it was uploaded :
$url=str_replace("s640x640/","",$url);
Is there some easy way to scale an image to a maximum size?
Looking for some some easy way to keep file sizes down and scale images that are uploaded from the app to max 640 width for example.
I have googled several solutions, from module Ti.ImageFactory to just put it into an ImageView with a size, and get the blob back again (which should make it scaled?). The Ti.ImageFactory module seems very old though, several years ago updated if you look at GIT. Also the zip files for download seems to be missing on git...
Ex.
Titanium.Media.openPhotoGallery({
success:function(event)
{
Ti.API.info('Our type was: '+event.mediaType);
if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
{
// HERE event.media needs to be scaled to a max
// size... for example 2 MB data, or max 960 px
// width/height or something similar
uploadPhoto(event.media);
}
},
cancel:function()
{
Ti.API.info("Photo gallery cancel...");
},
error:function(err)
{
//Ti.API.error(err);
Ti.API.info("Err: "+err);
alert(L("AN_ERROR_OCCURRED"));
},
mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO]
});
What you are looking for is the function imageAsCropped or imageAsResized.
Let me know if you need Further help.
You can use the size property.
size : Dimensionreadonly
The size of the view in system units.
Although property returns a Dimension dictionary, only the width and
height properties are valid. The position properties--x and y--are
always 0.
To find the position and size of the view, use the rect property
instead.
The correct values will only be available when layout is complete. To
determine when layout is complete, add a listener for the postlayout
event.
Documentation Link
I ended up using ti.imagefactory module.
The zip files for android and ios I found here:
https://github.com/appcelerator-modules/ti.imagefactory/releases
Example can be found here:
https://github.com/appcelerator-modules/ti.imagefactory/blob/stable/ios/example/app.js
I used code from the examples in my app and it seems to work fine!
Kinda new to wordpress.. Creating my own theme. When I upload an image and put it in a post it comes out at 300x183 pixels but the original file I upload is 1800x1100 pixels. Wordpress alters my size when i upload it.This is what i get in the url on the post NDAppleProductMockUp-300x183.jpg.. It restricts the size of the image. When i go into the image properties within the post and click original nothing happens it stays at 300x183.. I have tried to work it out but can't Any suggestions guys..
Thanks
Unfortunately, WordPress does not resize the actual image that you upload. It creates 3 smaller versions of it, leaving the uploaded image untouched. I would suggest that you create all of your images at 1800x1100 before you upload them.
Another solution would be to link to the "big-sized" image when you "Insert into Post"... unfortunately, you would have to know the filename of the large image. I check the source code and this part of the media system does not appear to be pluggable.
Another option may be to check out this plugin:
http://wordpress.org/extend/plugins/nextgen-gallery/
This link here details how You can change what image size will be displayed
http://codex.wordpress.org/Function_Reference/add_image_size
also when u attach to post you can set the image size in the setting
THE SETTING is Before you attach the image!
you are trying to change an image that has already been attached (the attached image was in a mid or small size to begin with) so it is already at its original size.
I have uploaded a photo in WordPress. I am trying to post a thumbnail of the image using a predetermined width while constraining the height proportionally.
In functions.js:
add_image_size('width-130', 130, 0, false);
On the page that outputs the thumbnail:
the_post_thumbnail('width-130');
According to the WordPress docs(http://codex.wordpress.org/Function_Reference/add_image_size), it says:
WordPress will create a copy of the post thumbnail with the specified
dimensions when you upload a new thumbnail.
Currently it is outputting the full thumbnail image with a width attribute of 130. This still requires the full size image to load, which is not what I want. I would like for WordPress to create an actual copy of the post thumbnail with the correct dimensions, and not just to set the width attribute. How can I achieve this?
I discovered my mistake.
Since I had not re-uploaded the image file, it was still trying to access the full size image which was the assigned image for that post, while adding the width attribute. Once I re-uploaded the image, the add_image_size() function is now actually creating a copy of the thumbnail with the correct dimensions.
I apologize for asking this question. If the community wants, I can close it but I figure it might be good reference for WordPress newbies such as myself.
Use this plugin to regenerate thumbnails.
http://wordpress.org/plugins/regenerate-thumbnails/
In case anyone runs across a similar problem, this may help. add_image_size generates derivatives that are smaller, but not bigger or the same size. Thus if you are trying to make a monochrome derivative image, uploading an image the same size as the monochrome, it will not be available and techniques like this one won't work.