Quantcast
Channel: WampServer - WampServer English
Viewing all articles
Browse latest Browse all 3177

Resize image and display (1 reply)

$
0
0
I have the following to display an image full size, and it works well.
echo '<img src="'.$path.$match["photoname"].'" />';

I also have a function that resizes an image, that come up with no errors.
The function is:
function resize_image($file, $w, $h, $crop=FALSE) {

and it returns data as follows
$src = imagecreatefromjpeg($file);
$dst = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

return $dst;


I cant seem to get the syntax correct to join the two together.

I have the following and I get nothing showing.
echo '<img src="resize_image('.$path.$match["photoname"].',200,200" />';
or
echo '<img src="$img=resize_image('.$path.$match["photoname"].',200,200" />';



Any pointers greatly appreciated.

Viewing all articles
Browse latest Browse all 3177

Trending Articles