WordPress.org

Ready to get started?Download WordPress

Forums

WP-Cycle
Missing images on server change (6 posts)

  1. greencode
    Member
    Posted 3 years ago #

    I've had to move server a few times recently and wp-cycle seems to be the only plugin that doesn't remember things! I always have to go back into the settings and re-upload the images that were once there. Is there any way around this as it's a bit tricky to remember when I'm dealing with more than one site.

  2. abtincjeremys
    Member
    Posted 3 years ago #

    i just had this problem too.

    problem is that uploads are saving the full URL (with domain) to the database -- you can see this in DB table wp_options:
    SELECT * FROM xxx.wp_options WHERE option_name LIKE '%wp_cycle%';

    this occurs in file \wp-content\plugins\wp-cycle\wp-cycle.php, method wp_cycle_handle_upload -- where it sets $upload_dir_url.

    i had some success changing it to:

    $upload_dir_url = wp_upload_dir();	//str_replace(basename($file), '', $url);
    $upload_dir_url = str_replace( get_bloginfo('url'), '', $upload_dir_url['url'] ) . '/';

    you could also just perform a replace in the database field, since it's a serialized array.

    UPDATE meant to use ['url'], not ['baseurl'] -- need the folder dates too, per wp_upload_dir() reference

  3. abtincjeremys
    Member
    Posted 3 years ago #

    gaah...

    UPDATE

    just noticed that the $url only gets fixed if the image is resized. otherwise it retains the original $url.

    add the following around line 151:

    else {
    	$url = $upload_dir_url . basename($url);
    }
  4. greencode
    Member
    Posted 3 years ago #

    Thanks for this - due to the lack of support I've decided to ditch this plugin anyway. But, I'm glad you managed to find a solution.

  5. Hoku31
    Member
    Posted 3 years ago #

    Thanks! You saved my night!

  6. robbdempsey
    Member
    Posted 3 years ago #

    @abtincjeremys do you have an example of how you took care of the folder dates?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags