当前位置: 首页>>代码示例>>PHP>>正文


PHP Storage::getURL方法代码示例

本文整理汇总了PHP中Storage::getURL方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::getURL方法的具体用法?PHP Storage::getURL怎么用?PHP Storage::getURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Storage的用法示例。


在下文中一共展示了Storage::getURL方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: TekVideo

   case 'TekVideo':
       $show_media = new TekVideo();
   break;
   default:
       die("Content ID $cid is non-media (not image, audio, or video)");
   break;
 }
 $show_media->load($cid);
 switch ($content_info->type) {
   case 'Audio':
     if (strstr($show_media->file_name, "http://")) {
       $src = $show_media->file_name;
       $file = $show_media->file_name;
     } else {
       $file = $show_media->file_name;
       $src = Storage::getURL($file);
     }
     $media_value = $show_media->file_name;
     $default_icon = uihelper_resize_mk_img(null, 86, 92, 'images/default_audio.png', "", RESIZE_CROP);
   break;
   case 'TekVideo':
     $image_show = '<script src="'.PA::$tekmedia_site_url.'/Integration/remotePlayer.php?video_id='.$show_media->video_id.'&preroll=true"></script>';
     $default_icon = uihelper_resize_mk_img(null, 86, 92, 'images/default_video.png', "", RESIZE_CROP);
     $media_value = $show_media->video_id;
   break;
   case 'Image':
     if (strstr($show_media->image_file, "http://")) {
       $tt = $show_media->image_file;
         $image_show = getimagehtml($tt, 86, 92, "", $tt);
         $media_value = $show_media->file_name;
     } else {
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:31,代码来源:attach_media.php

示例2: testStorage

 function testStorage()
 {
     // test Storage - public API
     // store test.txt
     echo "saving test.txt with a crazy name\n";
     $file_id = Storage::save('test.txt', 'O*Bc3wukygfsT@#($0876)$!@#*+_][.txt');
     echo "resulting file_id = {$file_id}\n";
     $file = Dal::query_one_object("SELECT * FROM files WHERE file_id=?", array($file_id));
     $this->assertEquals($file->link_count, 0);
     $this->assertEquals($file->last_linked, NULL);
     $file_path = Storage::getPath($file_id);
     $file_url = Storage::getURL($file_id);
     echo "getPath({$file_id}) -> {$file_path}\n";
     echo "getURL({$file_id}) -> {$file_url}\n";
     $this->assertTrue(strpos($file_path, PA::$path . "/web/files/") === 0);
     $this->assertTrue(strpos($file_url, PA::$url) === 0);
     // link it in somewhere
     $link_id = Storage::link($file_id, array('role' => 'avatar', 'user' => 1));
     echo "linked it in as avatar for user 1; link_id = {$link_id}\n";
     $link = Dal::query_one_object("SELECT * FROM file_links WHERE link_id=?", array($link_id));
     $this->assertEquals($link->file_id, $file_id);
     $file = Dal::query_one_object("SELECT * FROM files WHERE file_id=?", array($file_id));
     $this->assertEquals($file->link_count, 1);
     $this->assertNotEquals($file->last_linked, NULL);
     // another file
     $child_file_id = Storage::save('test2.txt', 'this is the child file.jpg', 'throwaway', 'image/jpeg');
     echo "child file: {$child_file_id}\n";
     $child_file = Dal::query_one_object("SELECT * FROM files WHERE file_id=?", array($child_file_id));
     $child_file_path = Storage::getPath($child_file_id);
     $child_file_url = Storage::getURL($child_file_id);
     echo "getPath({$child_file_id}) -> {$child_file_path}\n";
     echo "getURL({$child_file_id}) -> {$child_file_url}\n";
     $this->assertTrue(strpos($child_file_path, PA::$path . "/web/files/") === 0);
     $this->assertTrue(strpos($child_file_url, PA::$url) === 0);
     // link child file in as a thumbnail of first file
     $child_link_id = Storage::link($child_file_id, array('role' => 'thumb', 'file' => $file_id, 'dim' => '123x123'));
     echo "child link id: {$child_link_id}\n";
     $child_link = Dal::query_one_object("SELECT * FROM file_links WHERE link_id=?", array($child_link_id));
     $this->assertEquals($child_link->file_id, $child_file_id);
     $this->assertEquals($child_link->parent_file_id, $file_id);
     $child_file = Dal::query_one_object("SELECT * FROM files WHERE file_id=?", array($child_file_id));
     $this->assertEquals($child_file->link_count, 1);
     $this->assertNotEquals($child_file->last_linked, NULL);
     // this should fail (missing role)
     try {
         Storage::link($file_id, array("user" => 1));
         $this->fail("Expected exception");
     } catch (PAException $e) {
         $this->assertEquals($e->getCode(), BAD_PARAMETER);
     }
     // this should fail (missing network)
     try {
         Storage::link($file_id, array("role" => "header", "group" => 42));
         $this->fail("Expected exception");
     } catch (PAException $e) {
         $this->assertEquals($e->getCode(), BAD_PARAMETER);
     }
     // this should fail (network not valid)
     try {
         Storage::link($file_id, array("role" => "thumb", "network" => 1, "file" => $file_id, "dim" => "123x123"));
         $this->fail("Expected exception");
     } catch (PAException $e) {
         $this->assertEquals($e->getCode(), BAD_PARAMETER);
     }
     // this should fail (parent_file_id == file_id)
     try {
         $link_id = Storage::link($file_id, array("role" => "thumb", "file" => $file_id, "dim" => "123x123"));
         $this->fail("Expected exception");
     } catch (PAException $e) {
         $this->assertEquals($e->getCode(), BAD_PARAMETER);
     }
     // Now unlink the two files we just created ...
     // unlink the first - but don't delete it
     Storage::unlink($file_id, $link_id, FALSE);
     // make sure it's gone
     $this->assertEquals(Dal::query_one("SELECT * FROM file_links WHERE link_id=?", array($link_id)), NULL);
     // the file should still be there, with zero links, though
     $file = Dal::query_one("SELECT * FROM files WHERE file_id=?", array($file_id));
     $this->assertNotEquals($file, NULL);
     $this->assertEquals($file->link_count, 0);
     // try a bad unlink operation
     try {
         Storage::unlink($file_id, $child_link_id);
         $this->fail("Expected exception");
     } catch (PAException $e) {
         $this->assertEquals($e->getCode(), FILE_NOT_FOUND);
     }
     // unlink and delete the second
     Storage::unlink($child_file_id, $child_link_id);
     // make sure it's gone
     $this->assertEquals(Dal::query_one("SELECT * FROM file_links WHERE link_id=?", array($child_link_id)), NULL);
     // and make sure the file is gone too
     $this->assertEquals(Dal::query_one("SELECT * FROM files WHERE file_id=?", array($child_file)), NULL);
     // reap unlinked files (immediately - no grace period)
     Storage::cleanupFiles(-1, -1);
     // make sure the first file is now gone
     $this->assertEquals(Dal::query_one("SELECT * FROM files WHERE file_id=?", array($file_id)), NULL);
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:98,代码来源:StorageTest.php

示例3: api_resize_user_image

function api_resize_user_image($picture, $imageWidth, $imageHeight)
{
    $picture = trim($picture);
    if (empty($picture)) {
        return NULL;
    }
    // ripped off from web/includes/image_resize.php (uihelper_preprocess_pic_path)
    if (defined("NEW_STORAGE") && preg_match("|^pa://|", $picture)) {
        $picture = Storage::get($picture);
    } else {
        $picture = "files/{$picture}";
        if (!file_exists(PA::$project_dir . "/web/{$picture}") && !file_exists(PA::$core_dir . "/web/{$picture}")) {
            return NULL;
        }
    }
    if ($imageWidth) {
        // scale image down
        $im_info = ImageResize::resize_img("web", PA::$url, "files/rsz", $imageWidth, $imageHeight, $picture);
    } else {
        $im_size = @getimagesize(Storage::getPath($picture));
        $im_info = array('url' => Storage::getURL($picture), 'width' => $im_size[0], 'height' => $im_size[1]);
    }
    return array('url' => $im_info['url'], 'height' => (int) $im_info['height'], 'width' => (int) $im_info['width']);
}
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:24,代码来源:api_impl.php

示例4: esc

  <foaf:givenname><?php 
echo esc($user->first_name);
?>
</foaf:givenname>
  <foaf:family_name><?php 
echo esc($user->last_name);
?>
</foaf:family_name>
  <foaf:nick><?php 
echo esc($user->login_name);
?>
</foaf:nick>
  <foaf:mbox_sha1sum><?php 
echo sha1($user->email);
?>
</foaf:mbox_sha1sum>
<? if (array_key_exists("blog_url", $user_generaldata)) { ?>
  <foaf:weblog rdf:resource="<?php 
echo esc($user_generaldata['blog_url']['value']);
?>
"/>
<? } ?>
<? if ($user->picture) { ?>
  <foaf:depiction rdf:resource="<?php 
echo esc(Storage::getURL($user->picture));
?>
"/>
<? } ?>
 </foaf:Person>
</rdf:RDF>
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:30,代码来源:foaf.php


注:本文中的Storage::getURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。