=== Wordpress Instagrabber === Contributors: ferenyl, hypernode Tags: Instagram importer, Instagram images, Instagram, instagram stream, Instagram flow, Instagram tags, Instagram embed, Instagram oEmbed Requires at least: 3.4 Tested up to: 3.4.2 Stable tag: 2.0 License: GPLv2 or later Get images from Instagram and create posts automaticly and use multiple streams. Or just save images in your media library. == Description == Get images from instagram with simple setup. Add multiple streams and get images by #tags or by users. Requires a api key from instagram. Visit plugin setting page for help. What this plugin can do for you: * Display all your images from instagram. * Only display your images with a certain tag (eg #instablog). * Display images that you have liked. * Publish images that contains a tag. This is ideal for special sites as "longboarding day" or "users makeup" * Save images to media library instead of posting them. * Embed images with a instagram url You can choose to auto post or manually choose the images This plugin supports: * Custom Post types * Post formats * Taxonomies * Tags = Embed images by using one of these embed types = url Use a simple url from instagram on it's own line in the editor. like this: http://instagram.com/p/SAX0q8Tej0/ This will get the image with a width of 612 pixels. You can also add a letter to the end of the url to get a different size. The sizes are: * t = thumbnail (150x150 pixels) * m = medium (306x306 pixels) * l = large (612x612 pixels) Use it like this to get a 150x150 pixels image: http://instagram.com/p/SAX0q8Tej0/t shortcodes You can use shortcodes if you want more controll over the image. Just wpecify a width and that width will be used for the image. There are two shortcodes who does the same work. These two are: [embed width="350"]http://instagram.com/p/SAX0q8Tej0/[/embed] [instagram url="http://instagram.com/p/SAX0q8Tej0/" width="350"] These two shortcodes does the same thing. They display the image with 350 pixels in width and hight. If you want to use cron without calling wordpress you can use the instagrabber-cron.php file. See settings page for more information. This plugin uses the Instagram(tm) API and is not endorsed or certified by Instagram or Instagram, Inc. All Instagram(tm) logos and trademarks displayed on this plugin are property of Instagram, Inc. == Installation == 1. Upload plugin folder to to the /wp-content/plugins/ directory 2. Activate the plugin through the 'Plugins' menu in WordPress 3. Go to settings page and follow instructions 4. (optional) set up a automatic job for getting images (see under Other notes or on this link [Instagrabber Cron](http://johan-ahlback.com/?p=1163)). == Screenshots == 1. Instagrabber menu 2. Settings page 3. New stream 4. Streams 5. A stream == Frequently Asked Questions == = Why do I need to create a app on Instagram? = This plugin uses oauth to retrive information and images and that requires keys from instagram. It's secure and simple. = I don't see any images = Try to update the stream or check the stream settings. = Where can i find help? = There is a help page in WordPress when the plugin is activated. And there is a forum at WordPress.org. = This plugin does not work = Feel free to contact me! = What template functions can i use? = There are several at the moment and if you want me to add one you can request it in the support forum. se the functions file to see them. = My stream doesn't update = This is a problem with the plugin and how it handles images. Try updating the setting for auto get images or updating the stream. If that fails you can use cron. You can find instructions on how to do that on Other notes or at [Instagrabber Cron](http://johan-ahlback.com/?p=1163) == Usage == = Here is how you setup your first stream. = = Create a app att instagram = First go to http://instagram.com/developer/ and klick on manage clients. (You may have to register as a developer, just fill out the form). Klick on "Register new client". This will be your application. Fill out the like this: * Application Name: name it whatever you want * Description: Give it a nice description like "my app for instagrabber" * Website: You domain (http://myawesomesite.com) * OAuth redirect_uri: your domain + /wp-admin/admin-ajax.php?action=instagrabber_redirect_uri. Like this: http://myawesomesite.com/wp-admin/admin-ajax.php?action=instagrabber_redirect_uri Copy CLIENT ID and CLIENT SECRET and paste them in the settings page for instagrabber. = The settings page = The first two fields is information from your app that you created above. The third setting is a time schedule feature that will get your images and, depending on your stream settings, publish them. Choose a intervall and save. If this is set to never you will have to update the streams manually. The last option is optional but will help me. Show a after a post that shows a link to this plugin. This is not saved whit the post so you can turn it on and off and the link will dissapear. = How to add a stream = So now you will add a stream. This is a stream of images that follows a set of rules. There are two mayor types of streams, user streams and tag streams. A user stream only contains images from one user (the one who activates the stream) and a tag streams contains public images that contains a specific tag. Here is an explanation to the fields on the page: * Name: the name of the stream * Placeholder title for post: This will be the title. you can use these placeholders. %user% - the user that uploaded the image, %tag% - the tag for the stream and %caption% - tha caption for the image. So a title can look like this: "%user%: %caption%". But when you publish the image it will look like this: "ferenyl: I love my job". * Type: There are three different types now, user, tag and likes. The user type will get all images from a user, the tag type will get all images with a tag and likes type will get all images that a user has liked (the user is the one who has activated the stream). * Tag: The tag to use in a tag stream. Or filter a user stream with a tag. * Auto create post: Do you want to publish a image automaticly or do you want to do it manually? * Post Type: Do you have more than one post type? choose a post type to save in. * Post status: You can publish it right away or make it a draft if you want to edit them first. * Post format: if your theme support post formats you can choose one here (Image is ideal). * Taxonomy: Choose a taxonomy if you have more than one. * Term: Choose a term in that taxonomy * Taxonomy for tags: if you want to tag your image * Auto set tag: Convert the image instagram tags to wordpress tags * Attachment type: Choose how to attach the image to the post. Make sure your theme supports featured images before choosing that. Both is a great choice. You will be directed to the stream page when you have clicked on save. You must authorize the stream before you can use it. The stream will be connected with the user who authorizes it. = Create a automatic cron job for instagrabber = = The Problem = The problem seems to be a timeout in wp-cron. The import function runs but when the script creates the first post it just dies. It's a strange problem and i hard to reproduce. So i tried a new way to run the script and it's seems to be working. This seems to happen when there are a lot of unpublished images in the database hat needs to be published = The solution = The solution is a cron job. I will show you two ways of doing this. The first is only if you have acces ssh access to a server and the permissions the is required. The second way is using an external service and is free (limited free account). I'll be using Pingdom for that. = Crontab = **You need ssh access  for this one. Go to the next section if you don't have that. ** **Important: Remember to set Auto get photos to never first!** Write this in the terminal to create a new crontab: `crontab -e` The syntax for the cron job looks like this: `[minutes] [Hours] [date] [month] [day of the veek] script param` If i want to run a cron job the fifth minute every hour it looks like this: `5 * * * * script param` "*" means every. But i want to run my cronjob every 5 minutes so i'm using this: `*/5 * * * * script param` So now we know how to setup a cron job. But to run the cron file in instagrabber another thing is needed. A function to run and a url to use. We will be using wget for this. And the url is in "Instagrabber -> instagrabber settings" in your WordPress admin. my url to my local machine is: **http://plugins.ll/wp-content/plugins/instagrabber/instagrabber-cron.php. ** This is how my cron job would look like: `*/5 * * * * /usr/bin/wget -q -o /dev/null http://plugins.ll/wp-content/plugins/instagrabber/instagrabber-cron.php /dev/null 2>&1` A little breakdown: ` # run every five minutes */5 * * * * # start wget in quiet mode /usr/bin/wget -q # choose null file to keep wget from saving the file -o /dev/null # The url http://plugins.ll/wp-content/plugins/instagrabber/instagrabber-cron.php # write output to null file /dev/null 2>&1 ` Save the file and your cron job will run. = Setup cron with external service. = **Important: Remember to set Auto get photos to never first!** So you don't have access to ssh on a server. Don't worry, you can always use a webservice. Om going to show you have to setup a pingdom check for this. First create an account and log in. Klick on Add new check an fill it out. Write the cron url that you find on the settings page for instagrabber in the url field and test it. Now you have a cron job for instagrabber. == Changelog == = 2.0 = * Added oEmbed and shortcode see faq for more info * Added setting for image size when saving in post * Setting for allowing hastags in title * added support for multiple administrating users for a stream with a default user = 1.6.5 = * fixed some errors * added filter for image size * secrets: some 2.0 functions may have bleed trough.... = 1.6.3 = * fixed errors = 1.6.2 = * added a new function for saving images in media library without having to save it as a post. * added "save to media library" as a choise in stream setting and on stream page. (must be activated in settings) * removes attachement id from image when a image is deleted from media library = 1.6.1 = * Fixes a problem when images are removed from instagram. The whole stream failed. = 1.6 = If you had problems with previous verions this should fix the errors. If the auo get images not working, go to settings page and reset the function. * fixed errors * added a button to reset auto get images * added a uninstall button = 1.5.9 = * bug fixes = 1.5.8 = * changed how wp cron uses the import function * Fixed backup placeholder error * fixed error message from intagram = 1.5.7 = * added function to get images by instagram image id * added template functions = 1.5.6 = * changed functions to get images from curl to wp_http * changed redirect function to use wp_http = 1.5.5 = * Fixed error with widget * Changed function name = 1.5.4 = * Added a widget * fixed db function = 1.5.3 = * fixed cron file = 1.5.2 = * Added support for publish and save as draft on stream page * Changed 1 and 0 to yes and no in stream list. * better structure in files * Changed css on help page * Added created by field at stream view * Added extra placeholder as a backup if using %caption% placeholder and it's empty. If both empty use stream name. * Added change user field * Added a new placeholder: %date% = 1.5.1 = * Fixed unexpected output * Added check before trying to create tables * Added images to help page. = 1.5 = * changed max_tag_id to min_id for userstream. This is the correct way. * Added like stream support * Hide private images * fix bug in auth function * Added search in stream * Added username in stream table * Added images per page options in stream * Do not import private images. Integrity is important! * Added help page and help tab on pluginpage. * Removed button from New stream page. = 1.4 = * Added support for post formats * Fixed delete stream confirmation * Change title on new stream page if editing a stream. = 1.3 = * added gettext * Manual function for getting images = 1.2 = * Added the use of tags in user streams = 1.1 = * Added checks for cron job. Mark as running and mark as done. = 1.0 = * Initial realese