Witam mam klasę odpowiedzialną za zmienianie zdjęcia wgrywanego i wszystko działa ładnie. Wkurza mnie tylko że dodaje zdjęcie oryginalne a potem przerabia (wiem ze nie da się przerobić zdjęcia w locie) ale nie wiem jak mam usunąć po wgraniu zdjęcie oryginalne i aby zostało to tylko z zmienna $link
Kod:
elseif ($_GET['act'] == upload) {
<hr>
<center>
<p>
<h2>Dodaj zdjęcie</h2>
<ul class="gallery clearfix">
<li class="extra">
KONIEC;
// we first include the upload class, as we will need it here to deal with the uploaded file
include('include/class.upload.php');
// retrieve eventual CLI parameters
$cli = (isset($argc) && $argc > 1
); if ($cli) {
if (isset($argv[1
])) $_GET['file'] = $argv[1
]; if (isset($argv[2
])) $_GET['dir'] = $argv[2
]; if (isset($argv[3
])) $_GET['pics'] = $argv[3
]; }
// set variables
$dir_dest = (isset($_GET['dir']) ?
$_GET['dir'] : 'test'); $dir_pics = (isset($_GET['pics']) ?
$_GET['pics'] : $dir_dest);
if (!$cli) {
}
// we have three forms on the test page, so we redirect accordingly
if ((isset($_POST['action']) ?
$_POST['action'] : (isset($_GET['action']) ?
$_GET['action'] : '')) == 'simple') {
// ---------- SIMPLE UPLOAD ----------
// we create an instance of the class, giving as argument the PHP object
// corresponding to the file field from the form
// All the uploads are accessible from the PHP object $_FILES
$handle = new Upload($_FILES['my_field']);
// then we check if the file has been uploaded properly
// in its *temporary* location in the server (often, it is /tmp)
if ($handle->uploaded) {
// yes, the file is on the server
// now, we start the upload 'process'. That is, to copy the uploaded file
// from its temporary location to the wanted location
// It could be something like $handle->Process('/home/www/my_uploads/');
$handle->Process($dir_dest);
function TestProcess(&$handle, $title = 'test', $details='') {
$handle->Process($dir_dest);
if ($handle->processed) {
$link = ''.$dir_pics.'/' . $handle->file_dst_name .'';
<br>
<center>
<img src="$link" >
</center>
KONIEC;
} else {
echo '<fieldset class="classuploadphp">'; echo ' <legend>' . $title . '</legend>'; echo ' Error: ' . $handle->error . ''; if ($details) echo ' <pre class="code php">' . htmlentities($details) . '</pre>'; }
}
// -----------
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 800;
$handle->image_precrop = 15;
$handle->image_watermark = "watermark_large.png";
$handle->image_watermark_x = 20;
$handle->image_watermark_y = -20;
TestProcess($handle, '15px pre-cropping (before resizing 800 wide), large watermark automatically reduced, position 20 -20', "\$foo->image_resize = true;\n\$foo->image_ratio_y = true;\n\$foo->image_x = 800;\n\$foo->image_precrop = 15;\n\$foo->image_watermark = 'watermark_large.png';\n\$foo->image_watermark_x = 20;\n\$foo->image_watermark_y = -20;");
} else {
// one error occured
echo ' <legend>file not uploaded to the wanted location</legend>'; echo ' Error: ' . $handle->error . ''; }
// we copy the file a second time
// we delete the temporary files
$handle-> Clean();
} else {
// if we are here, the local file failed for some reasons
echo ' <legend>local file error</legend>'; echo ' Error: ' . $handle->error . ''; }
<li>
</ul>
</p>
</center>
KONIEC;
}
Pomoże ktoś?
Ten post edytował Jonek_1993 4.02.2011, 20:52:17