random изображения от дадена папка

val4o0o0

Registered
значи имам галерия в сайта, но всички снимки са в папката gallery, може ли да се направи някакъв скрипт и с тях да се искарва различна снимка при рефреш или при влизане в друга страница ? Също така да могат и да им се задават размери (оразмеряване) защото снимките са големи.
Благодаря !
 
http://web-tourist.net/login/login/view.php?st=2016

това ?


Edit :

Код:
<?php


$folder = '.';


$extList = array();
$extList['gif'] = 'image/gif';
$extList['jpg'] = 'image/jpeg';
$extList['jpeg'] = 'image/jpeg';
$extList['png'] = 'image/png';


$img = null;


if (substr($folder,-1) != '/') {
$folder = $folder.'/';
}


if (isset($_GET['img'])) {
$imageInfo = pathinfo($_GET['img']);
if (
isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) &&
file_exists( $folder.$imageInfo['basename'] )
) {
$img = $folder.$imageInfo['basename'];
}
} else {
$fileList = array();
$handle = opendir($folder);
while ( false !== ( $file = readdir($handle) ) ) {
$file_info = pathinfo($file);
if (
isset( $extList[ strtolower( $file_info['extension'] ) ] )
) {
$fileList[] = $file;
}
}
closedir($handle);


if (count($fileList) > 0) {
$imageNumber = time() % count($fileList);
$img = $folder.$fileList[$imageNumber];
}
}
if ($img!=null) {
$imageInfo = pathinfo($img);
$contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ];
header ($contentType);
readfile($img);
} else {
if ( function_exists('imagecreate') ) {
header ("Content-type: image/png");
$im = @imagecreate (100, 100)
or die ("Cannot initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 0,0,0);
imagestring ($im, 2, 5, 5, "NO IMAGES", $text_color);
imagepng ($im);
imagedestroy($im);
}
}
?>
 
<?php


$folder = 'imeto na papkata papkata';


$extList = array();
$extList['gif'] = 'image/gif';
$extList['jpg'] = 'image/jpeg';
$extList['jpeg'] = 'image/jpeg';
$extList['png'] = 'image/png';


$img = null;


if (substr($folder,-1) != '/') {
$folder = $folder.'/';
}


if (isset($_GET['img'])) {
$imageInfo = pathinfo($_GET['img']);
if (
isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) &&
file_exists( $folder.$imageInfo['basename'] )
) {
$img = $folder.$imageInfo['basename'];
}
} else {
$fileList = array();
$handle = opendir($folder);
while ( false !== ( $file = readdir($handle) ) ) {
$file_info = pathinfo($file);
if (
isset( $extList[ strtolower( $file_info['extension'] ) ] )
) {
$fileList[] = $file;
}
}
closedir($handle);


if (count($fileList) > 0) {
$imageNumber = time() % count($fileList);
$img = $folder.$fileList[$imageNumber];
}
}
if ($img!=null) {
$imageInfo = pathinfo($img);
$contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ];
header ($contentType);
readfile($img);
} else {
if ( function_exists('imagecreate') ) {
header ("Content-type: image/png");
$im = @imagecreate (100, 100)
or die ("Cannot initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 0,0,0);
imagestring ($im, 2, 5, 5, "NO IMAGES", $text_color);
imagepng ($im);
imagedestroy($im);
}
}
?>
 
Код:
[phpBB Debug] PHP Notice: in file /var/www/new/random.php on line 51: Cannot modify header information - headers already sent by (output started at /var/www/new/integrated.php:57)
GIF89a ������������������򺺺���444��ė�����TTT!�NETSCAPE2.0!� , �H�� *\�p�	h�p����"��8��G>D)���R4�C���I��Ë\��9p��:ȹs��1_2`�p`�� u�< u�SY�ڐkǞ`�F�hv�ƴ6S>u��+�ryJ�/Q�M.0@�p_�+�+���/�KY&]����9�ى Mr�	�`i�x�r\����˪ vf���jMO�&*Z��؇o�>;��ܦŝ"�,<�x��Q�W 0���T�W�.4z cO�c52��P�F�!� ,����*���� �ЀE�2.0��Ł7r,0��A�"&$��@��\�%E0	0���@�8?�D��'Ǜ�4�� ���fϦU!����I�`�&<@���`͚���!� ,�, ���,@`A�,4���' `�"D�;���3(���G� �(��� �ɀ&F�����НF�t��iӤ)oJuz� ��N�`z���~���c@ř֣�d!� ,�(���HȰ�,X���B�/&�hP"ŊN�Ȑ#�� ��р	h$�ҥƆj �P�˔mE8p�Q��*��P��\��Ճ�~4p� �� 88���0Vm��ۃ��@���@Ͼ�j���v���z�%À!� ,��@���a�� #.$� ��+ �Q�Ǝ9z�qŊ1j,�Q#Ǔ# �I���8h���@Şt�JsB==Zs�҆:[ <�T�O�u2x�+��$#v=@k±�VDK��T�g8P�Э��j!� ,}H� �(`��@� :L� !�3b�1�;�H�ȁ�4�@�&	�y��h�r$�(�@� `S�Io:,�rdR�O}5��*Ƭ�b=P�kY�s�=I�c@!� ,�H��A$�@�A$,�@C�Pؼr�S�E.�ٴjT�WYR Y�+ѫ�����K��b ��ڌ!� ,�H���*
 

Back
Горе