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


PHP ElggFile::setFilenameOnFilestore方法代码示例

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


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

示例1: ElggBatch

}
/**
 * Convert 'hjfile' to 'file'
 */
$subtypeIdFrom = add_subtype('object', 'hjfile');
$subtypeIdTo = add_subtype('object', 'file');
$dbprefix = elgg_get_config('dbprefix');
$query = "\tUPDATE {$dbprefix}entities e\r\n\t\t\t\tJOIN {$dbprefix}metadata md ON md.entity_guid = e.guid\r\n\t\t\t\tJOIN {$dbprefix}metastrings msn ON msn.id = md.name_id\r\n\t\t\t\tJOIN {$dbprefix}metastrings msv ON msv.id = md.value_id\r\n\t\t\t\tSET e.subtype = {$subtypeIdTo}\r\n\t\t\t\tWHERE e.subtype = {$subtypeIdFrom} AND msn.string = 'handler' AND msv.string = 'hjwall' ";
$wall_files = new ElggBatch('elgg_get_entities_from_metadata', array('types' => 'object', 'subtypes' => 'file', 'metadata_name_value_pairs' => array('name' => 'handler', 'value' => 'hjwall'), 'limit' => false));
foreach ($wall_files as $file) {
    // Regenerate icons
    if ($file->simpletype == 'image') {
        $thumb_sizes = array('tiny' => 16, 'small' => 25, 'medium' => 40, 'large' => 100, 'preview' => 250, 'master' => 500, 'full' => 1024);
        foreach ($thumb_sizes as $ths => $dim) {
            $thumb = new ElggFile();
            $thumb->setFilenameOnFilestore("hjfile/{$file->getGUID()}{$ths}.jpg");
            unlink($thumb->getFilenameOnFilestore());
        }
        $file->icontime = time();
        $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 60, 60, true);
        if ($thumbnail) {
            $thumb = new ElggFile();
            $thumb->setFilename($prefix . "thumb" . $filestorename);
            $thumb->open("write");
            $thumb->write($thumbnail);
            $thumb->close();
            $file->thumbnail = $prefix . "thumb" . $filestorename;
            unset($thumbnail);
        }
        $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 153, 153, true);
        if ($thumbsmall) {
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:31,代码来源:upgrades.php

示例2: upgrade20140211

 public function upgrade20140211()
 {
     $ia = elgg_set_ignore_access(true);
     /**
      * Wall owner should become the container of the wall post
      * wall_owner relationship should go away
      */
     $wall_posts = new \ElggBatch('elgg_get_entities_from_relationship', array('types' => 'object', 'subtypes' => 'hjwall', 'relationship' => 'wall_owner', 'limit' => false));
     foreach ($wall_posts as $wall_post) {
         $relationships = get_entity_relationships($wall_post->guid, true);
         foreach ($relationships as $relationship) {
             if ($relationship->relationship !== 'wall_owner') {
                 continue;
             }
             if ($relationship->guid_one !== $wall_post->container_guid) {
                 $wall_post->container_guid = $relationship->guid_one;
                 if ($wall_post->save()) {
                     $relationship->delete();
                 }
             }
         }
     }
     /**
      * Convert attachment metadata to 'attached' relationship for entities
      * and 'html' metadata for the rest
      */
     $wall_posts = new \ElggBatch('elgg_get_entities_from_metadata', array('types' => 'object', 'subtypes' => 'hjwall', 'metadata_names' => 'attachment', 'limit' => false));
     foreach ($wall_posts as $wall_post) {
         $attachment = $wall_post->attachment;
         if (is_numeric($attachment) && ($attached_entity = get_entity($attachment))) {
             add_entity_relationship($attached_entity->guid, 'attached', $wall_post->guid);
         } else {
             $wall_post->html = $attachment;
         }
         unset($wall_post->attachment);
     }
     /**
      * Convert 'hjfile' to 'file'
      */
     $subtypeIdFrom = add_subtype('object', 'hjfile');
     $subtypeIdTo = add_subtype('object', 'file');
     $dbprefix = elgg_get_config('dbprefix');
     $query = "\tUPDATE {$dbprefix}entities e\n\t\t\t\tJOIN {$dbprefix}metadata md ON md.entity_guid = e.guid\n\t\t\t\tJOIN {$dbprefix}metastrings msn ON msn.id = md.name_id\n\t\t\t\tJOIN {$dbprefix}metastrings msv ON msv.id = md.value_id\n\t\t\t\tSET e.subtype = {$subtypeIdTo}\n\t\t\t\tWHERE e.subtype = {$subtypeIdFrom} AND msn.string = 'handler' AND msv.string = 'hjwall' ";
     $wall_files = new \ElggBatch('elgg_get_entities_from_metadata', array('types' => 'object', 'subtypes' => 'file', 'metadata_name_value_pairs' => array('name' => 'handler', 'value' => 'hjwall'), 'limit' => false));
     foreach ($wall_files as $file) {
         // Regenerate icons
         if ($file->simpletype == 'image') {
             $thumb_sizes = array('tiny' => 16, 'small' => 25, 'medium' => 40, 'large' => 100, 'preview' => 250, 'master' => 500, 'full' => 1024);
             foreach ($thumb_sizes as $ths => $dim) {
                 $thumb = new ElggFile();
                 $thumb->setFilenameOnFilestore("hjfile/{$file->getGUID()}{$ths}.jpg");
                 unlink($thumb->getFilenameOnFilestore());
             }
             $file->icontime = time();
             $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 60, 60, true);
             if ($thumbnail) {
                 $thumb = new ElggFile();
                 $thumb->setFilename($prefix . "thumb" . $filestorename);
                 $thumb->open("write");
                 $thumb->write($thumbnail);
                 $thumb->close();
                 $file->thumbnail = $prefix . "thumb" . $filestorename;
                 unset($thumbnail);
             }
             $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 153, 153, true);
             if ($thumbsmall) {
                 $thumb->setFilename($prefix . "smallthumb" . $filestorename);
                 $thumb->open("write");
                 $thumb->write($thumbsmall);
                 $thumb->close();
                 $file->smallthumb = $prefix . "smallthumb" . $filestorename;
                 unset($thumbsmall);
             }
             $thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 600, 600, false);
             if ($thumblarge) {
                 $thumb->setFilename($prefix . "largethumb" . $filestorename);
                 $thumb->open("write");
                 $thumb->write($thumblarge);
                 $thumb->close();
                 $file->largethumb = $prefix . "largethumb" . $filestorename;
                 unset($thumblarge);
             }
         }
     }
     /**
      * Set file folder guids as plugin setting
      */
     $folders = new \ElggBatch('elgg_get_entities_from_metadata', array('types' => 'object', 'subtypes' => 'hjfilefolder', 'metadata_name_value_pairs' => array('name' => 'handler', 'value' => 'hjwall'), 'limit' => false));
     foreach ($folders as $folder) {
         elgg_set_plugin_user_setting('wall_collection', $folder->guid, $folder->owner_guid, 'hypeWall');
     }
     /**
      * Convert 'hjfilefolder' to 'wall_collection'
      */
     $subtypeIdFrom = add_subtype('object', 'hjfilefolder');
     $subtypeIdTo = add_subtype('object', 'wallcollection');
     $dbprefix = elgg_get_config('dbprefix');
     $query = "\tUPDATE {$dbprefix}entities e\n\t\t\t\tJOIN {$dbprefix}metadata md ON md.entity_guid = e.guid\n\t\t\t\tJOIN {$dbprefix}metastrings msn ON msn.id = md.name_id\n\t\t\t\tJOIN {$dbprefix}metastrings msv ON msv.id = md.value_id\n\t\t\t\tSET e.subtype = {$subtypeIdTo}\n\t\t\t\tWHERE e.subtype = {$subtypeIdFrom} AND msn.string = 'handler' AND msv.string = 'hjwall' ";
     elgg_set_ignore_access($ia);
 }
开发者ID:justangel,项目名称:hypeWall,代码行数:100,代码来源:Upgrades.php


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