本文整理汇总了PHP中Random::newHexString方法的典型用法代码示例。如果您正苦于以下问题:PHP Random::newHexString方法的具体用法?PHP Random::newHexString怎么用?PHP Random::newHexString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Random
的用法示例。
在下文中一共展示了Random::newHexString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_to_gallery
function add_to_gallery()
{
$gallery_peer = new GalleryPeer();
$gallery = $gallery_peer->find_by_id(Params::get("id_gallery"));
$collection_peer = new GalleryCollectionPeer();
$gallery_collection = $collection_peer->find_by_id($gallery->id_gallery_collection);
$full_folder_path = GalleryCollectionController::GALLERY_COLLECTION_ROOT_DIR . $gallery_collection->folder . "/" . $gallery->folder;
if (Upload::isUploadSuccessful("file")) {
$filename = Random::newHexString() . "_" . Upload::getRealFilename("file");
$gallery_dir = new Dir($full_folder_path);
$uploaded_img = Upload::saveTo("file", $gallery_dir, $filename);
if (isset(Config::instance()->GALLERY_RESIZE_BY_WIDTH)) {
image_w($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_WIDTH);
} else {
if (isset(Config::instance()->GALLERY_RESIZE_BY_HEIGHT)) {
image_h($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_HEIGHT);
}
}
$peer = new GalleryImagePeer();
$do = $peer->new_do();
$peer->setupByParams($do);
$do->image_name = $filename;
$peer->save($do);
return Redirect::success();
} else {
Flash::error(Upload::getUploadError("file"));
return Redirect::failure();
}
}
示例2: create_collection
function create_collection()
{
$peer = new GalleryCollectionPeer();
$do = $peer->new_do();
$peer->setupByParams($do);
$do->folder = Random::newHexString();
$d = new Dir(self::GALLERY_COLLECTION_ROOT_DIR . $do->folder);
$d->touch();
$peer->save($do);
if (is_html()) {
return Redirect::success();
} else {
return Result::ok();
}
}
示例3: create_gallery
function create_gallery()
{
$peer = new GalleryPeer();
$gallery = $peer->new_do();
$peer->setupByParams($gallery);
$gallery->folder = Random::newHexString();
$peer_collection = new GalleryCollectionPeer();
$collection = $peer_collection->find_by_id($gallery->id_gallery_collection);
$d = new Dir(GalleryCollectionController::GALLERY_COLLECTION_ROOT_DIR . $collection->folder . "/" . $gallery->folder);
$d->touch();
$peer->save($gallery);
if (is_html()) {
return Redirect::success();
} else {
return Result::ok();
}
}
示例4: newRandomSubdir
function newRandomSubdir()
{
return $this->newSubdir(Random::newHexString());
}