# Resizing files in php

**URL:** <https://forum.kirupa.com/t/resizing-files-in-php/236817>\
**Category:** Uncategorized\
**Created:** [August 23, 2007, 8:02pm UTC](https://forum.kirupa.com/t/resizing-files-in-php/236817 "2007-08-23T20:02:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wo1olf](https://avatars.discourse-cdn.com/v4/letter/w/278dde/32.png) [@wo1olf](https://forum.kirupa.com/u/wo1olf)\
**Post date:** [August 23, 2007, 8:02pm UTC](https://forum.kirupa.com/t/resizing-files-in-php/236817/1 "2007-08-23T20:02:00Z")

</div>

is there a way to resize images (in terms of bytes) in php ?  
I started this code, but i’m blocked on how to resize the image and save it

```php
function resizePic($filename)
{
    define("BIG_SIZE",400);
    define("SMALL_SIZE",30);
    $imgInfo = getimagesize($filename);
    $imgWidth = $imgInfo[0];
    $imgHeight = $imgInfo[1];
    $scale = $imgHeight/$imgWidth;
    $bigWidth = $scale*DETAIL_SIZE;
    $smallWidth = $scale*LIST_SIZE;
     // how to save the new resized image?
}

```
