# PHP Image Resize

**URL:** <https://forum.kirupa.com/t/php-image-resize/49820>\
**Category:** programming\
**Created:** [April 26, 2004, 10:18pm UTC](https://forum.kirupa.com/t/php-image-resize/49820 "2004-04-26T22:18:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amp1](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@amp1](https://forum.kirupa.com/u/amp1)\
**Post date:** [April 26, 2004, 10:18pm UTC](https://forum.kirupa.com/t/php-image-resize/49820/1 "2004-04-26T22:18:12Z")

</div>

Alright, I have a PHP file for random images… but I want to resize them, specifically to the size of the web browser. Can anyone help me?

Here is my code in case you need it…

```php

<?php

$total = "3";

$file_type = ".jpg";

$image_folder = "images/stigg";

$start = "1";

$random = mt_rand($start, $total);

$image_name = $random . $file_type;

echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />";

?>

```
