copy, resize, move image with php
11,719
Solution 1
I wrote this Class a while ago to wrap the GD library functions.
You can call it like:
$image = new Image('original/path/to.file', 'destination/of/resized.file');
$image->resize(300, 200);
$image->output();
$image->clean();
update:
This class no longer functions as explained above.
Here is a new example:
$image = new Image();
$image->source('original/path/to.file');
$image->destination('destination/of/resized.file');
$image->Manipulate->Resize(300,200);
$image->output();
$image->clean();
Solution 2
Have you tried the GD library? Very powerful.
Solution 3
Use the GD Lib or ImageMagick. With ImageMagick it is the resizeImage function.
Author by
ThomasReggi
Updated on July 13, 2022Comments
-
ThomasReggi almost 2 years
I'm looking to copy, resize, and move an image. This is simular to how wordpress creates different sizes of the images when you upload. I want this to be executable without uploading anything just running when you run the page.
example:
$imagePath = 'http://example.com/images/myimageonserver.jpg'; $newImagePath = 'http://example.com/images/new/myimageonserver.jpg'; $newImageWidth = 300; $newImageHeight = 200;
Does anyone know a script that will do this? Or some useful functions that can get this done.