Title: Does not work on localhost
Last modified: November 10, 2016

---

# Does not work on localhost

 *  [Sridhar Katakam](https://wordpress.org/support/users/srikat/)
 * (@srikat)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/)
 * Hello,
 * Same issue as with the earlier incarnation of the plugin.
 * ![screenshot](http://d.pr/i/zV6Q+)
 * WP site on localhost powered by DesktopServer.
 * PHP 5.5.24, cURL support enabled v7.30.0
 * Any idea?

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/does-not-work-on-localhost-2/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/does-not-work-on-localhost-2/page/2/?output_format=md)

 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8424707)
 * Hi [@srikat](https://wordpress.org/support/users/srikat/),
    How do I get started
   with Desktop server? I don’t even know what it is 🙂
 * Free?
 *  Thread Starter [Sridhar Katakam](https://wordpress.org/support/users/srikat/)
 * (@srikat)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8424914)
 * DS uses XAMPP and allows us to easily spin up WP sites on localhost.
 * They do have a free version which has certain limitations but those limitations
   do not matter for testing the issue being discussed here.
 * It can be downloaded here: [https://serverpress.com/get-desktopserver/](https://serverpress.com/get-desktopserver/)
 * Thanks in advance.
 *  [sebastianlaube](https://wordpress.org/support/users/sebastianlaube/)
 * (@sebastianlaube)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8512278)
 * I had the same problem and after debugging it related to two roots.
 * First of all, check if php-curl module is installed.
 * Second, my virtual machine was using the wrong date, so curl stopped because 
   the certificate of unsplash was valid in the future.
 * Hope this helps.
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8515459)
 * [@sebastianlaube](https://wordpress.org/support/users/sebastianlaube/) thanks
   for this.
 * [@srikat](https://wordpress.org/support/users/srikat/) Can you let me know if
   this helps you before I install Desktop Server to try and sort this out?
 *  Thread Starter [Sridhar Katakam](https://wordpress.org/support/users/srikat/)
 * (@srikat)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8581378)
 * [@sebastianlaube](https://wordpress.org/support/users/sebastianlaube/) I checked
   the output of phpinfo() and do see that cURL is enabled.
 * ![screenshot](http://d.pr/i/h8z3+)
 * I do not have Apache and other parts of the localhost server inside a VM.
 * Any other ideas?
 *  [Luis Martins](https://wordpress.org/support/users/lmartins/)
 * (@lmartins)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8602800)
 * Having the same issue too. Im using Laravel Valet running PHP7 and like Sridhar
   I have cURL support enabled. When uploading manually to the media section the
   server is able to push create the files. However Instant Images doesn’t seem 
   to be able to do so. It creates a file on what I assume is a temporary folder:
   
   [https://cl.ly/1U0p3e2V293V](https://cl.ly/1U0p3e2V293V)
 * But the file never gets to the folder which would make it available for WordPress
   media.
 *  [Luis Martins](https://wordpress.org/support/users/lmartins/)
 * (@lmartins)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8602810)
 * Just to update on this, not sure if you are familiar but Laravel runs the server
   using the native server scripts, not a VM is what I mean. It is now based on 
   nginx, not sure if that makes any difference in this case.
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8603098)
 * [@lmartins](https://wordpress.org/support/users/lmartins/) thanks for this.
    
   Your screenshot shows the temporary file is created on the server (`/instant-
   images`), but is likely failing in the next step which is transferring this file
   to the media library.
 * Line 286 of `instant-images/admin/admin.php` is the `instant_img_resize_image()`
   function that resizes, uploads the image via `media_sideload_image()` and deletes
   the original.
 * [https://plugins.trac.wordpress.org/browser/instant-images/trunk/admin/admin.php#L286](https://plugins.trac.wordpress.org/browser/instant-images/trunk/admin/admin.php#L286)
 * Do you see anything in this function that could be causing problems?
    -  This reply was modified 9 years, 5 months ago by [Darren Cooney](https://wordpress.org/support/users/dcooney/).
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8647417)
 * Hey guys,
    I just pushed a new version of the plugin that fixed the issue other
   users were having in this thread – i’m hopeful this will fix the issue for you
   as well. [https://wordpress.org/support/topic/upload-error-34/](https://wordpress.org/support/topic/upload-error-34/)
 * [@srikat](https://wordpress.org/support/users/srikat/) i’m not sure if this will
   work for you since UnsplashWP didn’t work either but fingers crossed.
 *  Thread Starter [Sridhar Katakam](https://wordpress.org/support/users/srikat/)
 * (@srikat)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8711819)
 * Just tried the current latest version. Same problem.
 *  Thread Starter [Sridhar Katakam](https://wordpress.org/support/users/srikat/)
 * (@srikat)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8711830)
 * [https://wordpress.org/plugins/featured-image-generator/](https://wordpress.org/plugins/featured-image-generator/)
   is working fine.
 *  [Rhand](https://wordpress.org/support/users/rhand/)
 * (@rhand)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8842842)
 * Similar issues here using Laravel Valet LEMP. Plugin states image is downloaded
   successfully, but it is never added to media. I made instant-images 777 just 
   in case and I did see the image getting added and removed. It is just never added
   to the media folder. I think `media_sideload_image` could be the issue as it 
   attaches to a post and I would say we do not need to attach to a post, but just
   register and store in the media library. Not 100% certain however.
    Perhaps you
   should check out [https://plugins.trac.wordpress.org/browser/featured-image-generator/trunk/admin/class-featured-image-generator-admin.php#L381](https://plugins.trac.wordpress.org/browser/featured-image-generator/trunk/admin/class-featured-image-generator-admin.php#L381)
    -  This reply was modified 9 years, 3 months ago by [Rhand](https://wordpress.org/support/users/rhand/).
    -  This reply was modified 9 years, 3 months ago by [Rhand](https://wordpress.org/support/users/rhand/).
    -  This reply was modified 9 years, 3 months ago by [Rhand](https://wordpress.org/support/users/rhand/).
    -  This reply was modified 9 years, 3 months ago by [Rhand](https://wordpress.org/support/users/rhand/).
    -  This reply was modified 9 years, 3 months ago by [Rhand](https://wordpress.org/support/users/rhand/).
 *  [Rhand](https://wordpress.org/support/users/rhand/)
 * (@rhand)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8843076)
 * Perhaps code like
 *     ```
       require_once(ABSPATH . 'wp-admin/includes/media.php');
       require_once(ABSPATH . 'wp-admin/includes/file.php');
       require_once(ABSPATH . 'wp-admin/includes/image.php');
   
       $image_url = "http://domain.com/blog/23092839823";
       $image_tmp = download_url($image_url);
   
           if( is_wp_error( $image_tmp ) ){
               echo "<br> Image Download Fail:";
           }else {
               $image_size = filesize($image_tmp);
               $image_name = basename($image_url) . ".jpg"; // .jpg optional
   
               //Download complete now upload in your project
               $file = array(
                  'name' => $image_name, // ex: wp-header-logo.png
                  'type' => 'image/jpg',
                  'tmp_name' => $image_tmp,
                  'error' => 0,
                  'size' => $image_size
               );
   
               //This image/file will show on media page...
               $thumb_id = media_handle_sideload( $file, $post_id, $desc);
               set_post_thumbnail($post_id, $thumb_id); //optional
   
               echo "<br> Image Save ";
           }
       ```
   
 * mentioned at [SO](http://stackoverflow.com/questions/13954550/wordpress-media-sideload-image-download-http-placekitten-com-100-100).
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8855245)
 * [@rhand](https://wordpress.org/support/users/rhand/),
    Thanks for the investigation.
 * Since I don’t have a development env to test Desktop Server or Laraval Valet 
   I was wondering if you would want to help contribute to the plugin?
 * As I said above, the issue would be on line 286 of `instant-images/admin/admin.
   php`. The `instant_img_resize_image()` function that resizes, uploads the image
   via `media_sideload_image()` is where things are failing.
 * if you have time and the ambition it would likely help other users.
 * Cheers,
 *  [Rhand](https://wordpress.org/support/users/rhand/)
 * (@rhand)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/#post-8875771)
 * Will be putting it on my agenda. That is besides the theme I am working on and
   accompanying portfolio plugin [@dcooney](https://wordpress.org/support/users/dcooney/).
   When I have something I will let you know.

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/does-not-work-on-localhost-2/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/does-not-work-on-localhost-2/page/2/?output_format=md)

The topic ‘Does not work on localhost’ is closed to new replies.

 * ![](https://ps.w.org/instant-images/assets/icon-256x256.png?rev=2504172)
 * [Instant Images - One-click Image Uploads from Unsplash, Openverse, Pixabay, Pexels, and Giphy](https://wordpress.org/plugins/instant-images/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/instant-images/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/instant-images/)
 * [Active Topics](https://wordpress.org/support/plugin/instant-images/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/instant-images/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/instant-images/reviews/)

 * 17 replies
 * 6 participants
 * Last reply from: [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/does-not-work-on-localhost-2/page/2/#post-9125791)
 * Status: not resolved