Mam taki skrypt który wrzuca mi zdjecia na serwer - pytanie moje jest takie : co w nim zmienic zeby zdjecia wrzucane na serwer mialy kolejne numery - nazwa bylaby zmieniana -
drugie pytanie jak poźniej wyswietlic te zdjecia ? minatury ,
Czy da sie zrobic tak że jak klikne na minaturke to adres obrazka czyli np
http://mojserwer/galeria/1.jpg zostanie skopiowany do schowka ?
Teraz ctrl v i adres moge sobie gdzies wkleic
<?php
// ---------- IMAGE 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) {
$handle->Process('./galeria/min');
// yes, the file is on the server
// below are some example settings which can be used if the uploaded
// file is an image.
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 200;
// 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('./galeria/min');
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 600;
// 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('./galeria/big');
// we check if everything went OK
if ($handle->processed) {
// everything was fine !
echo ' <legend>file uploaded with success</legend>'; echo ' <img src="test/' . $handle->file_dst_name . '" />'; echo ' <p>' . $info['mime'] . ' - ' . $info[0] . ' x ' . $info[1] .' - ' . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB</p>'; echo ' link to the file just uploaded: <a href="test/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a><br/>'; } else {
// one error occured
echo ' <legend>file not uploaded to the wanted location</legend>'; echo ' Error: ' . $handle->error . ''; }
} else {
// if we're here, the upload file failed for some reasons
// i.e. the server didn't receive the file
echo ' <legend>file not uploaded on the server</legend>'; echo ' Error: ' . $handle->error . ''; }
?>
Ten post edytował Lonas 17.10.2006, 13:56:12