mohanwiki
mohanwiki

Reputation: 49

Rackspace Clouds: Modify image of the container and clear cache

I have tired several times to upload a image to rackspace cloud using php and modifying it with another image. But it showed first image after uploading the second image to same object and replacing it.

This is what I did on first script:

<?php
$images    = $conn->get_container('title');
$obj       = $images->create_object('sample_test1');
$file_name = $_SERVER['DOCUMENT_ROOT'] . '/cloudfiles/images/1308.jpg';
$obj->load_from_filename($file_name);
echo $obj->public_uri();
?>

Second script to modify sample_test1 object:

<?php
$images    = $conn->get_container('title');
$obj       = $images->get_object('sample_test1');
$file_name = $_SERVER['DOCUMENT_ROOT'] . '/cloudfiles/images/2000.jpg';
$obj->load_from_filename($file_name);
echo $obj->public_uri();
?>

When I check the printed url on browser it always shows the first image which I uploaed. Not the second one.

Upvotes: 2

Views: 556

Answers (1)

mohanwiki
mohanwiki

Reputation: 49

I have a solution for this. The CDN will keep the image cached until the TTL expires. So you will see the second image you uploaded after about a day (as your TTL expires). You have to keep an image object with timestamps or something. And delete the first uploaded image.

Upvotes: 2

Related Questions