![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 14 Pomógł: 0 Dołączył: 30.11.2011 Ostrzeżenie: (0%) ![]() ![]() |
Witam. Mam pewien problem
Miedzy innymi chcem zrobic hosting zdjęc na skrypcie CF Image host. Lecz gdy zdjecie się wrzuci to gdy biorę bezposredni link to wrzuca mi zdjęcie na czystą strone... patrz tutaj http://s349171127.domenaklienta.pl/hosting/?di=P5XH . A chcem aby to zdjęcie było "obłozone" w szablon. Jeszcze jedno. Gdy naciskamy na zdjęcie to wyswietla nam je w "Ramce" a chcem aby odrazu wczytywało zdjecie "obłozone" patrz http://s349171127.domenaklienta.pl/hosting/?pm=P5XH Jak zmienic to aby Bezposredni link: dawał linka do zdjęcia w całym szablonie. Z góry dzieki Na prosbe moge wstawic kod . Tylko jaki plik za to odpowiada Jezeli nie ten dział to bardzo przepraszam Kod // UPLOAD CODE START // see if user is banned if (db_isBanned()){ sendError($LANGUAGE_PACK["site_upload_banned"]); } // see if a image url has been posted if((isset($_POST['imgUrl']) && !empty($_POST['imgUrl'])) || isset($imgApiUrl)){ $image['URL'] = input(isset($_POST['imgUrl'])?$_POST['imgUrl']:$imgApiUrl); require_once("lib/remoteImage.class.php"); $remoteImage = new remoteImages($DIR_TEMP,$settings,$LANGUAGE_PACK); $remoteImage->validExtensions = $imgFormats; $remoteImage->validType = $acceptedFormats; $remoteImage->minDimensions = $IMG_MIN_SIZE; $remoteImage->maxDimensions = $IMG_MAX_SIZE; if($remoteImage->getImage($image['URL'])){ //check that a file has been found and copyed to the temp dir if(!is_null($remoteImage->file)){ $_FILES = $remoteImage->file; } }else{ sendError($remoteImage->error); } } if( ($_SERVER['REQUEST_METHOD'] == 'POST' || isset($api)) && $_FILES['file']['name'][0] !='' && !isset($_SESSION['err'])){ require_once("./lib/resize.class.php"); require_once("./lib/phpDupeImage.php"); $imgCount = 0; for($i=0; $i < count($_FILES['file']['name']);++$i){ // setup image var $pieces = explode("?", $_FILES['file']['name'][$i]); $pathInfo = pathinfo($_FILES['file']['name'][$i]); $imgSize = @getimagesize($_FILES['file']['tmp_name'][$i]); $image['name'] = $pieces[0]; $image['alt'] = removeSymbols(input(!empty($_POST["alt"][$i])?$_POST["alt"][$i]:$pathInfo['filename'])); $image['temp'] = $_FILES['file']['tmp_name'][$i]; $image['type'] = $imgSize['mime']; $image['size'] = ($_FILES['file']['size'][$i] < 1?@filesize($file_tmp_name):$_FILES['file']['size'][$i]); $removeList[] = $image['temp']; //check it's a image & set image extension if(!$image['ext'] = get_extension( $image['type'], false )){ sendError(sprintf($LANGUAGE_PACK["site_upload_types_accepted"],implode(", ",$imgFormats)),'extension'); continue; } //min size(pixels) if ($imgSize[0] < $IMG_MIN_SIZE || $imgSize[1] < $IMG_MIN_SIZE ){ sendError(sprintf($LANGUAGE_PACK["site_upload_to_small"],$IMG_MIN_SIZE.'x'.$IMG_MIN_SIZE),'tosmall'); continue; } // max size(pixels) if ($imgSize[0] > $IMG_MAX_SIZE || $imgSize[1] > $IMG_MAX_SIZE ){ sendError(sprintf($LANGUAGE_PACK["site_upload_to_big"],$IMG_MAX_SIZE.'x'.$IMG_MAX_SIZE)); continue; } //Check file size (kb) if($image['size'] > $settings['SET_MAXSIZE']){ sendError(sprintf($LANGUAGE_PACK["site_upload_size_accepted"],format_size($settings['SET_MAXSIZE'])),'tobig'); continue; } //Make Image fingerprint $finger = new phpDupeImage(); $fingerprint = $finger->fingerprint($image['temp']); //check for Duplicate Images if($settings['SET_NODUPLICATE']){ // If similar files exist, check them if($fp=findImage('fingerprint',$fingerprint)){ foreach($fp as $fpItem){ if ($finger->are_duplicates($image['temp'],imageAddress(1,$fpItem))){ $dupFound = true; break; } } if(isset($dupFound)){ sendError($LANGUAGE_PACK["upload_duplicate_found"],'duplicate'); continue; } } } //New random name //Number of Possible Combinations // 3 digit code 46656 // 4 digit code 1679616 // 5 digit code 60466176 $image['id'] = createHash(4,true); //random delete ID $image['did'] = $image['id'].createHash(6); //Image address $image['new'] = $image['id'].'.'.$image['ext']; $image['address'] = $DIR_IMAGE.$image['new']; // convert BMP to JPG and PSD to PNG if(in_array($image['ext'],array('psd','bmp'))){ //Reset Image address $image['ext'] = ($image['ext'] == 'psd'?$PNG_SAVE_EXT:$JPG_SAVE_EXT); $image['new'] = $image['id'].'.'.$image['ext']; $image['address'] = $DIR_IMAGE.$image['new']; // convert psd/bmp to png $convert = new resize($image['temp']); $convert->imageConvert($image['address'],($image['ext'] == 'psd'?$PNG_QUALITY:$JPG_QUALITY)); $convert->destroyImage(); } //move image from remote server elseif(isset($image['URL']) && input($image['URL']) != ''){ @copy($image['temp'],$image['address']); } //move uploaded image else{ move_uploaded_file($image['temp'],$image['address']); } // move file check if(!file_exists($image['address'])){ sendError($LANGUAGE_PACK["site_upload_err"].' .','filemove'); continue; } //Resize image if needed if ($settings['SET_RESIZE_IMG_ON']) { if((isset($_POST['new_width'][$i]) && !empty($_POST['new_width'][$i])) || (isset($_POST['new_height'][$i]) && !empty($_POST['new_height'][$i]))){ $new_dim = new resize($image['address']); $new_dim -> stretchSmallImages(TRUE); if(!empty($_POST['new_width'][$i]) && !empty($_POST['new_height'][$i])){ $new_dim -> resizeImage($_POST['new_width'][$i], $_POST['new_height'][$i], 'exact'); } elseif(!empty($_POST['new_width'][$i]) && empty($_POST['new_height'][$i])){ $new_dim -> resizeImage($_POST['new_width'][$i], $imgSize[0], 'landscape'); } elseif(empty($_POST['new_width'][$i]) && !empty($_POST['new_height'][$i])){ $new_dim -> resizeImage($imgSize[1], $_POST['new_height'][$i], 'portrait'); } $new_dim -> saveImage($image['address'],100); $new_dim -> destroyImage(); $imgSize = @getimagesize($image['address']);// update image size for db } } //Thumb address $THUMB_ADDRESS = $DIR_THUMB.$image['new']; $THUMB_MID_ADDRESS = $DIR_THUMB_MID.$image['new']; // thumb $resize = new resize($image['address']); $resize ->setMemoryLimit ($IMG_MEMORY_LIMIT); $resize ->setTweakFactor ($IMG_TWEAK_FACTOR); // make thumb $resize -> resizeImage($THUMB_MID_MAX_WIDTH, $THUMB_MID_MAX_HEIGHT, $THUMB_MID_OPTION); $resize -> saveImage($THUMB_MID_ADDRESS, ($image['ext'] == 'png'?$PNG_QUALITY:$JPG_QUALITY)); // make small thumb $resize -> resizeImage($THUMB_MAX_WIDTH, $THUMB_MAX_HEIGHT, $THUMB_OPTION); $resize -> saveImage($THUMB_ADDRESS, ($image['ext'] == 'png'?$PNG_QUALITY:$JPG_QUALITY)); $resize -> destroyImage(); //see if thumb's got made if(!file_exists($THUMB_ADDRESS) || !file_exists($THUMB_MID_ADDRESS)){ @unlink($image['address']); @unlink($THUMB_ADDRESS); @unlink($THUMB_MID_ADDRESS); sendError($LANGUAGE_PACK["site_upload_err"].' ..','thumbmade'); continue; } // see if we need to get a short url for the image if (isset($_POST['shorturl'][$i]) && $_POST['shorturl'][$i] == 1 && $settings['SET_SHORT_URL_ON']){ $shorturl = shorturl_url('http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']).'?di='.$image['id']); } // get thumb's file size $image['size'] = @filesize($image['address']); $thumbsize = @filesize($THUMB_MID_ADDRESS); $sthumbsize = @filesize($THUMB_ADDRESS); // Make image info array to save to db $newImageArray = array( 'id' => $image['id'], 'name' => $image['name'], 'alt' => $image['alt'], 'added' => time(), 'ext' => $image['ext'], 'ip' => $_SERVER['REMOTE_ADDR'], 'size' => $image['size'], 'deleteid' => $image['did'], 'thumbsize' => $thumbsize, 'sthumbsize'=> $sthumbsize, 'private' => (isset($_POST['private'][$i])?1:0), 'report' => 0, 'shorturl' => (!isset($shorturl)?null:$shorturl), 'fingerprint' =>$fingerprint, ); //save new image to database if(addNewImage($newImageArray)){ // save image to upload array to be sent to thumb page $_SESSION['upload'][] = array('id' => $image['id'],'did' => $image['did']); // count images uploaded $imgCount++; if($imgCount >= $settings['SET_MAX_UPLOAD'] && !checklogin()){ break; // break upload loop as you have updated max number of images in one go... } }else{ sendError($LANGUAGE_PACK["site_index_delete_image_err_db"],'savedb'); continue; } }// end image upload loop } // error uploading image elseif(!isset($_SESSION['err'])){ sendError($LANGUAGE_PACK["site_upload_err"].' ...','uk'); } // remove temp images if(isset($removeList)){ foreach ($removeList as $tempImg){ // remove old file if(file_exists($tempImg)){ unlink($tempImg); } } } Bardzo proszę o odpowiedz Ten post edytował xeron01 1.12.2011, 14:46:02 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 24.08.2025 - 04:01 |