Jump to content

[SOLVED] php image help


40esp

Recommended Posts

Im trying to follow a turorial located at: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php to resize images being uploaded.

 

The tutorial says to use:

 

<?php
   if( isset($_POST['submit']) ) {
      include('SimpleImage.php');
      $image = new SimpleImage();
      $image->load($_FILES['uploaded_image']['tmp_name']);
      $image->resizeToWidth(150);
      $image->output();
   } else {
?>

 

I've modified it to my needs as so:

 

<?php
   if( isset($_POST['upload']) ) {
      include('resize.php');
      $image = new SimpleImage();
      $image->load($_FILES['uploaded_image']['tmp_name']);
      $image->resizeToWidth(150);
      $image->output();
   }
?>

 

but there is no option to output it to a specific directory... I don't understand what to do. Anyhelp would be appreciated.

Thanks

Link to comment
https://forums.phpfreaks.com/topic/109146-solved-php-image-help/
Share on other sites

Well, this is the save method:

function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null)

 

So therefore, you can do:

$image->save("picture2.png", IMG_PNG, 100, 755);

 

That'll give you a PNG at picture2.png, with 100% compression (though I don't think you can use compression with PNG in this class), and you'll CHMOD it to 755.  But think it's a bit unnecessary, and it may cause permission problems, so you can probably get away with:

 

$image->save("picture2.png", IMG_PNG);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.