Herkes bu sorunun ne olduğunu bana söyleyebilir misiniz? Dosya zaman damgası kullanılarak yeniden adlandırılabilir ancak uzatma ayıklanır ve yeni bir isim yer almaz.
$filenameext = pathinfo($filename, PATHINFO_EXTENSION);
$today = getdate();
$uniqueStr = $today[year];
$uniqueStr .= $today[mon];
$uniqueStr .= $today[wday];
$uniqueStr .= $today[mday];
$uniqueStr .= $today[hours];
$uniqueStr .= $today[minutes];
$uniqueStr .= $today[seconds];
$filename = $uniqueStr.".".$filenameext;
Tam kodu:
<?php
$folder = 'images/';
$orig_w = 500;
if( isset($_POST['submit']) )
{
$imageFile = $_FILES['image']['tmp_name'];
$filenameext = pathinfo($filename, PATHINFO_EXTENSION);
$today = getdate();
$uniqueStr = $today[year];
$uniqueStr .= $today[mon];
$uniqueStr .= $today[wday];
$uniqueStr .= $today[mday];
$uniqueStr .= $today[hours];
$uniqueStr .= $today[minutes];
$uniqueStr .= $today[seconds];
$filename = $uniqueStr.".".$filenameext;
list($width, $height) = getimagesize($imageFile);
$src = imagecreatefromjpeg($imageFile);
$orig_h = ($height/$width)* $orig_w;
$tmp = imagecreatetruecolor($orig_w, $orig_h);
imagecopyresampled($tmp, $src, 0,0,0,0,$orig_w,$orig_h,$width,$height);
imagejpeg($tmp, $folder.$filename,100);
imagedestroy($tmp);
imagedestroy($src);
$filename = urlencode($filename);
header("Location: crop.php?filename=$filename&height=$orig_h");
}
>