function createArchive($album_id, $zip) { if (!file_exists(ABSOLUTE_PATH . "/assets/images/albums/{$album_id}")) { mkdir(ABSOLUTE_PATH . "/assets/images/albums/{$album_id}"); } $singleAlbum = fetchSingleAlbums($album_id); foreach ($singleAlbum as $photo) { $url = $photo->source; $destination_path = ABSOLUTE_PATH . '/assets/images/albums/' . $album_id . '/' . $photo->id . '.jpg'; downloadImage($url, $destination_path); $zip->addFile($destination_path, $album_id . '/' . $photo->id . '.jpg'); } }
$insertid = intval($insertid) + 1; $scene_id = array('scene' => array('scene_id' => $insertid)); if (empty($_GET['type'])) { $postdatas = array('expire_seconds' => '1800', 'action_name' => 'QR_SCENE', 'action_info' => $scene_id); } else { $postdatas = array('action_name' => 'QR_LIMIT_SCENE', 'action_info' => $scene_id); } $postdatas = json_encode($postdatas); $qrcode = https_request('https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=' . $access_token, $postdatas); $qrcode = json_decode($qrcode, true); if (empty($_GET['type'])) { $filepath = 'source/plugin/aljwsq/images/wxqrcode_tmp/' . $insertid; } else { $filepath = 'source/plugin/aljwsq/images/wxqrcode/' . $insertid; } $returndata = downloadImage('https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . $qrcode['ticket'], $filepath); C::t('#aljwsq#aljwsq_wxqrcode')->insert(array('scene_id' => $insertid, 'qrcode' => $returndata['filename'], 'ticket' => $returndata['ticket'], 'type' => $_GET['type'], 'mykeyword' => $_GET['mykeyword'], 'dateline' => TIMESTAMP)); } else { cpmsg('请确认你的公众号是否拥有二维码权限,并在插件设置中填写appid和appsecret', 'action=plugins&operation=config&do=' . $_GET['do'] . '&identifier=aljwsq&pmod=advanced&wid=wxqrcodelist&act=wxqrcodelist', 'error'); } cpmsg(lang('plugin/aljwsq', 'autoreply17'), 'action=plugins&operation=config&do=' . $_GET['do'] . '&identifier=aljwsq&pmod=advanced&wid=wxqrcodelist&act=wxqrcodelist', 'succeed'); } else { include template('aljwsq:advanced/wxaddqrcode'); } } else { if ($_GET['act'] == 'wxdeleteqrcode') { if ($_GET['formhash'] == FORMHASH && $_GET['qid']) { C::t('#aljwsq#aljwsq_wxqrcode')->delete($_GET['qid']); } cpmsg('删除成功!', 'action=plugins&operation=config&do=' . $_GET['do'] . '&identifier=aljwsq&pmod=advanced&wid=wxqrcodelist&act=wxqrcodelist', 'succeed'); } else {
/* * ********************************************** If we're signed in we can go ahead and retrieve data * ********************************************** */ set_time_limit('10000'); if (isset($_SESSION['google_token'])) { $client = Zend_Gdata_AuthSub::getHttpClient($_SESSION['google_token']); $userInfo = $_SESSION['google_userInfo']; $album_ids = explode(',', $_GET['album_ids']); foreach ($album_ids as $album_id) { $singleAlbum = fetchSingleAlbums($album_id); if (!file_exists(ABSOLUTE_PATH . "/assets/images/archive")) { mkdir(ABSOLUTE_PATH . "/assets/images/archive"); } $filepath = $album_id; if (!file_exists(ABSOLUTE_PATH . "/assets/images/albums/{$filepath}")) { mkdir(ABSOLUTE_PATH . "/assets/images/albums/{$filepath}"); } $result = addAlbum($client, 'Test Album'); $albumId = $result->getGphotoId()->getText(); foreach ($singleAlbum as $photo) { $url = $photo->source; $destination_path = ABSOLUTE_PATH . '/assets/images/albums/' . $filepath . '/' . $photo->id . '.jpg'; downloadImage($url, $destination_path); addPhoto($client, $userInfo->user_id, $albumId, $photo->id, $destination_path); } } echo '<p class="bg-success"> Your album has been move to your picasa account successfully.</p>'; } else { echo 'first login via google inorder to move your album to picasa account'; }
if ($_POST["partsgroup"]) { $file .= $encl . $PG . $encl . $delim; $html .= "<td>" . $zeile["partsgroup"] . "</td>"; } if ($_POST["notes"]) { $file .= $encl . strtr($zeile["notes"], chr(13) . chr(10), " ") . $encl . $delim; $html .= "<td>" . $zeile["notes"] . "</td>"; } if ($_POST["image"]) { $file .= $encl . $zeile["image"] . $encl . $delim; $html .= "<td>" . $zeile["image"] . "</td>"; } $i++; fputs($f, substr($file, 0, -1) . $crln); if ($zeile["image"] && $_POST["image"]) { downloadImage($zeile["image"], $zeile["partnumber"]); } if ($_POST["show"]) { ?> <tr class="smal" onMouseover="this.bgColor='#FF0000';" onMouseout="this.bgColor='<?php echo $LineCol; ?> ';" bgcolor="<?php echo $LineCol; ?> "> <?php echo $html; ?> </tr> <?php
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $article = Article::find($id); if ($article) { $validator = Validator::make($request->all(), ['title' => 'required|max:255', 'content' => 'required', 'date_published' => 'required']); if ($validator->fails()) { return redirect()->route('articleEdit', array($article->id))->withErrors($validator)->withInput(); } $article->title = $request->get('title'); $article->content = $request->get('content'); $article->active = $request->get('active'); $article->date_published = $request->get('date_published'); if ($request->file('image')) { //TODO: delete old file $article->image = downloadImage($request, $article->id, $request->file('image')->getClientOriginalExtension()); } $article->save(); return redirect()->route('articleEdit', array($article->id))->with('message', 'Article has been changed successful!'); } }
public function avatar() { $avatar = "http://tp4.sinaimg.cn/1772890455/50/5641353221/1"; $uid = "153030"; $targetPath = "public/data/images/header/" . checkfolder($uid); if (!is_dir($targetPath)) { mkdir($targetPath, 0777, true); } $filename_big = 'avatar_big_' . $uid; $filename = $targetPath . $filename_big; $img_info = downloadImage($avatar, $filename); var_export($img_info); $posfix = "jpg"; $filename_big = $img_info['filename']; $f = explode(".", $filename_big); if (isset($f[1])) { if ($f[1] != "jpg") { copy($img_info['filepath'], $filename . ".jpg"); if (!file_exists($filename . ".jpg")) { $posfix = $f[1]; } } } echo $posfix; $filename_middle = 'avatar_middle_' . $uid . '.' . $posfix; $result = saveThumbImg_ex($posfix, $targetPath, $filename_big, 200, 200); var_export($result); if (file_exists($targetPath . $filename_middle)) { unlink($targetPath . $filename_middle); } rename($targetPath . 'thumb_' . $filename_big, $targetPath . $filename_middle); $filename_small = 'avatar_small_' . $uid . '.' . $posfix; $result = saveThumbImg_ex($posfix, $targetPath, $filename_big, 50, 50); var_export($result); if (file_exists($targetPath . $filename_small)) { unlink($targetPath . $filename_small); } rename($targetPath . 'thumb_' . $filename_big, $targetPath . $filename_small); echo avatar($uid, $posfix); }
public function temp() { $appPath = $this->api_config['upload']['temp']['path'] . "/"; $savePath = FCPATH . $appPath; makeDirectory($savePath); $img_src = urldecode($this->input->get('src')); $save_name = "tbk_" . mktime() . "_" . mt_rand(1000, 9999); $savePath = $savePath . $save_name; $download_info = downloadImage($img_src, $savePath); if (is_array($download_info)) { $images = $this->ImageServers_model->getDataModel(); $save_name = $download_info['filename']; $images['filename'] = $save_name; $images['path'] = $appPath; $images['w'] = $download_info['width']; $images['h'] = $download_info['height']; $images['size'] = $download_info['size']; $images['type'] = $download_info['mime']; $images['time'] = mktime(); $this->my_result(1, "上传成功"); $this->code['info'] = $images; } else { $this->my_result(-1, "上传失败"); } $data = $this->code; $this->echo_api(1, $data); }
/** * 自动下载第三方图片 * @param array $data * @return boolean */ private function auto_save_avatar($uid, $avatar) { $targetPath = "public/data/images/header/" . checkfolder($uid); if (!is_dir($targetPath)) { mkdir($targetPath, 0777, true); } $filename_big = 'avatar_big_' . $uid; $filename = $targetPath . $filename_big; $img_info = downloadImage($avatar, $filename); /* $img_info['filepath'] = ""; $img_info['width'] = ""; $img_info['height'] = ""; $img_info['orginalfilename'] = ""; $img_info['filename'] = ""; $img_info['mime'] = ""; $img_info['size'] = ""; */ $posfix = "jpg"; $filename_big = $img_info['filename']; $f = explode(".", $filename_big); if (isset($f[1])) { if ($f[1] != "jpg") { copy($img_info['filepath'], $filename . ".jpg"); if (!file_exists($filename . ".jpg")) { $posfix = $f[1]; } } } $filename_middle = 'avatar_middle_' . $uid . '.' . $posfix; $result = saveThumbImg_ex($posfix, $targetPath, $filename_big, 200, 200); if (file_exists($targetPath . $filename_middle)) { unlink($targetPath . $filename_middle); } rename($targetPath . 'thumb_' . $filename_big, $targetPath . $filename_middle); $filename_small = 'avatar_small_' . $uid . '.' . $posfix; $result = saveThumbImg_ex($posfix, $targetPath, $filename_big, 50, 50); if (file_exists($targetPath . $filename_small)) { unlink($targetPath . $filename_small); } rename($targetPath . 'thumb_' . $filename_big, $targetPath . $filename_small); }