• I have used this plugin for months. Occasionally when I upload a image, I got thumbnails(125×125, 150×150 etc.) uploaded successfully, but failed to upload the original file. It does create a file in my CDN with the same name but the size is 0B.

    Screenshot

    Now I am having this error almost every time I upload an image.

    What might be causing this problem? Thank you in advance for your help!

    https://wordpress.org/plugins/rackspace-cloud-files-cdn/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jameskzhao

    (@jameskzhao)

    Update:

    I managed to figure out what the problem was and fixed it. I added the following code to function upload_images():

    $check_original_image = false;
    for($i=0;$i<count($files_to_upload['upload']);$i++){
        if($files_to_upload['upload'][$i]['fn']==$meta_value['file']){
            $check_original_image = true;
        }
    }
    if(!$check_original_image){
        $files_to_upload['upload'][] = array('fn' => $meta_value['file']);
    }

    Now the original file gets uploaded to CDN, and url is available:

    https://xxxxxxxxx.cf2.rackcdn.com/filename.jpg

    but the url of the image is still local,

    http://mysite.com/wp-content/uploads/filename.jpg

    Because I chose to remove local image once it’s uploaded to cdn, the image still can’t be displayed.

    I am not sure how to resolve this kind of problem.

    Thread Starter jameskzhao

    (@jameskzhao)

    Update 2:

    OK. I found what the problem was:

    in function set_cdn_path, verify_exists( $new_attachment ) sometimes can’t detect the image although it is already on CDN.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Original image file can't be uploaded to CDN’ is closed to new replies.