<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//namespace google\appengine\api\cloud_storage;
//require_once 'google/appengine/api/cloud_storage/CloudStorageTools.php';
//use google\appengine\api\cloud_storage\CloudStorageTools;
$options = ['gs_bucket_name' => 'motivatestudy-967.appspot.com'];
$upload_url = CloudStorageTools::createUploadUrl('/import_data.php', $options);
?>
<form action="<?php 
echo $upload_url;
?>
" enctype="multipart/form-data" method="post">
    Files to upload: <br>
   <input type="file" name="uploaded_files" size="40">
   <input type="submit" value="Send">
</form>
示例#2
0
<?php

require_once "google/appengine/api/cloud_storage/CloudStorageTools.php";
echo "dsss";
echo CloudStorageTools::getDefaultGoogleStorageBucketName();
session_start();
echo file_get_contents("gs://silken-eye-693.appspot.com/settings.json");
if ($_POST != NULL && $_POST['security'] == session_id()) {
    file_put_contents("gs://silken-eye-693.appspot.com/settings.json", $_POST['data']);
} else {
    echo "ERROR: Security check problem!";
}
示例#3
0
 function add_article_html($data)
 {
     global $user;
     $helper_obj = new Helper();
     $tag_obj = new Tag();
     $cat_obj = new Category();
     $uid = $user['id'];
     $cid = $user['cid'];
     $title = trim($data['title']);
     // $video = trim($data['video']);
     $ck = trim($data['ck']);
     // $ck = str_replace("<script>", "***script***", $ck);
     //$ck = str_replace("</script>", "***@script***", $ck);
     //$add_category = trim($data['add_category']);
     $add_pgrate = trim($data['add_pgrate']);
     $section = trim($data['section']);
     if (isset($_FILES['image1'])) {
         $image2_type = explode(".", $_FILES['image1']['name']);
         $image2 = $helper_obj->generate_name() . '.' . $image2_type[1];
         $gs_name = $_FILES['image1']['tmp_name'];
         $move = copy($gs_name, 'gs://' . GOOGLE_APP_ID . '/article/' . $image2 . '');
         $move = copy($gs_name, 'gs://' . GOOGLE_APP_ID . '/feature/' . $image2 . '');
         $move = copy($gs_name, 'gs://' . GOOGLE_APP_ID . '/thumbnail/' . $image2 . '');
         $object_image_file1 = 'gs://' . GOOGLE_APP_ID . '/article/' . $image2 . '';
         $object_image_url1 = CloudStorageTools::getImageServingUrl($object_image_file1, ['size' => 620, 'crop' => false]);
         $object_image_file2 = 'gs://' . GOOGLE_APP_ID . '/feature/' . $image2 . '';
         $object_image_url2 = CloudStorageTools::getImageServingUrl($object_image_file2, ['size' => 100, 'crop' => true]);
         $object_image_file3 = 'gs://' . GOOGLE_APP_ID . '/thumbnail/' . $image2 . '';
         $object_image_url3 = CloudStorageTools::getImageServingUrl($object_image_file3, ['size' => 320, 'crop' => true]);
         $move = copy($object_image_url1, 'gs://' . GOOGLE_APP_ID . '/article/' . $image2 . '');
         $move = copy($object_image_url2, 'gs://' . GOOGLE_APP_ID . '/feature/' . $image2 . '');
         $move = copy($object_image_url3, 'gs://' . GOOGLE_APP_ID . '/thumbnail/' . $image2 . '');
         //move_uploaded_file($_FILES["image1"]["tmp_name"], VIDEOS_IMAGES_PATH_UPLOAD . $image2);
         //$im = $helper_obj->img_resize(VIDEOS_IMAGES_PATH_UPLOAD . $image2, 620);
         //$helper_obj->imageToFile($im, VIDEOS_IMAGES_PATH_UPLOAD . $image2, 100);
         /*$helper_obj->resize_crob_image(VIDEOS_IMAGES_PATH_UPLOAD . $image2, VIDEOS_IMAGES_THUMBNAIL_PATH_UPLOAD . $image2, 
                                              THUMBNAIL_W, THUMBNAIL_H, THUMBNAIL_R, THUMBNAIL_ENABLE);           
           
               $helper_obj->resize_crob_image(VIDEOS_IMAGES_PATH_UPLOAD . $image2, VIDEOS_IMAGES_PATH_FEATURE_UPLOAD . $image2, 
                                              FEATURE_W, FEATURE_H, THUMBNAIL_R, THUMBNAIL_ENABLE);   */
         //woman app
         if ($cid == 49) {
             /*  $helper_obj->resize_crob_image(VIDEOS_IMAGES_PATH_UPLOAD . $image2, VIDEOS_IMAGES_THUMBNAIL_320x272_PATH_UPLOAD . $image2, 
                                                    IMAGE_320x272_W, IMAGE_320x272_H, THUMBNAIL_R, THUMBNAIL_ENABLE);           
                 
                     $helper_obj->resize_crob_image(VIDEOS_IMAGES_PATH_UPLOAD . $image2, VIDEOS_IMAGES_THUMBNAIL_320x352_PATH_UPLOAD . $image2, 
                                                IMAGE_320x352_W, IMAGE_320x352_H, THUMBNAIL_R, THUMBNAIL_ENABLE);  */
         }
     }
     // $image = trim($data['image1']);
     $now = time();
     /* $query = "insert into articles_html (title, body, image, added_by, date_added, client_id, category_id, pg_rated_id, section, video) 
        value 
        ('$title', '$ck', '$image2', '$uid', '$now', '$cid', '$add_category', '$add_pgrate', '$section', '$video')";     */
     $query = "insert into articles_html (title, body, image, added_by, date_added, client_id, pg_rated_id, section) \n                  value \n                  ('{$title}', '{$ck}', '{$image2}', '{$uid}', '{$now}', '{$cid}', '{$add_pgrate}', '{$section}')";
     //  echo($query);
     $result = $this->conn->db_query($query) or die(mysql_error());
     $last_id = "";
     $last_id = $this->conn->db_last_insert_id(NULL, NULL);
     //added NULL, NULL to remove warning
     //add tags
     foreach ($data['add_tag'] as $tag_id) {
         $tag_obj->add_tags_to_article($last_id, $tag_id);
     }
     //add categories
     foreach ($data['add_category'] as $cat_id) {
         $cat_obj->add_categories_to_article($last_id, $cat_id);
     }
     return $last_id;
 }