Skip to main content
9thReg
Known Participant
October 18, 2012
Question

Image upload question

  • October 18, 2012
  • 1 reply
  • 538 views

Hi all,

I've got an image upload section for an admin page.  I've tried countless tutorials, but I just can't seem to get anything to work the way I want it to.  I'm trying to resize the uploaded image to a specific size (w=215; h=250) and maintain the transparency of the png file.  All I can get to work is a simple upload that does not resize.  So far I've got this:

$current_image=$_FILES['image']['name'];

$extension = substr(strrchr($current_image, '.'), 1);

if ($extension != "png")

{

die('Unknown extension');

}

$new_image = $current_image;

$destination="../../assets/subfolder/".$country."/".$new_image;

$action = copy($_FILES['image']['tmp_name'], $destination);

if (!$action)

{

die('File copy failed');

}else{

Can anyone please help me get this to resize and keep the transparency?  Or point me in the right direction where I can find a tutorial that I can get to work?

Thank you very much.,

This topic has been closed for replies.

1 reply

David_Powers
Inspiring
October 22, 2012

My book, PHP Solutions, 2nd Edition, devotes an entire chapter to generating and uploading thumbnail images. It's not free, but it might help you if you're stuck.