Autor Zpráva
xypsylonzet
Profil *
mam script na vytvareni nahledu:

<?php
function make_thumb ($img_src, $img_th)
{
$quality = 30;
$img_size = GetImageSize ($img_src);
$img_in = ImageCreateFromJPEG ($img_src);
$img_y = 90;
$img_x = 120;
$img_out = ImageCreateTrueColor($img_x, $img_y);
ImageCopyResampled ($img_out, $img_in, 0, 0, 0, 0, $img_x, $img_y, $img_size[0], $img_size[1]);
ImageJPEG ($img_out, $img_th, $quality);
ImageDestroy ($img_out);
ImageDestroy ($img_in);
}

if (isset ($_FILES['image']['name']))
{
$fn = $_FILES['image']['name'];
$src = 'images/'.$fn;
$th = 'thumbs/'.$fn;
if (!@move_uploaded_file ($_FILES['image']['tmp_name'], $src)) die ('Can not upload file...');
make_thumb ($src, $th);
}
?>
<form enctype="multipart/form-data" action="thumb.php" method="post">
Thumbnail this file: <input name="image" type="file">
<input type="submit" value="Send File">
</form>


ale obrazky uklada jako 600 a nahledy jako 644. Jak to zmenit? Vadi to?
DJ Miky
Profil
A co hned za fci ImageJPEG dát chown($img_th, 0777)?
tomas.fejfar
Profil *
chown($img_th, 0777)?
není lepší pro bezpečnost nechat jen 770? (pocitaje, ze user je take ve skupine www-data)
tomas.fejfar
Profil *
teda ;) 771 ( jinak by nesel cist zvenku :) )
xypsylonzet
Profil *
tomas.fejfar> a jak by to ohrozilo bezpecnost?
xypsylonzet
Profil *
chown? ne nahodou chmod?
Alphard
Profil
jj, chmod a možná bude potřeba umask
xypsylonzet
Profil *
alphard> stacil jen ten chmod

chmod($img_th, 0777);

chmod($img_src, 0777);


a jaky atribut tam teda dat?
xypsylonzet
Profil *
664 tomu dat?
Toto téma je uzamčeno. Odpověď nelze zaslat.

0