Forum Replies Created

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

    (@jameskzhao)

    Hi Mike,

    Thank you for your reply. The problem might be from new features introduced in WC Strpe Gateway v4.1.0, because I installed an older version (4.0.7) and everything works fine now.

    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.

    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,

    https://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.

Viewing 3 replies - 1 through 3 (of 3 total)