-2

I have a bunch if images on my server and i want people to be able to access it with one URL. So i put a list of the URLs in my data base with their id. I need help with just returning the image through PHP.

All the images are square and are between 300x300 and 500x500 but i want them returned as 1000x1000

Here is the code i have i just dont know how to set it to be 1000x1000

<?php
 $name = 'test.jpg';
 $fp = fopen($name, 'rb');
 header("Content-Type: image/jpg");
 fpassthru($fp);
?>

To be clear. I am not looking to save the images on my server. I have a image URL from another web site. I want to display on my web site resized, but i want the URL in the img src to have the image as though it was on my server.

knowzero
  • 78
  • 8

1 Answers1

0

Check if your PHP installation supports GD by using phpinfo(). In your code, you need to include this:

$size = GetimageSize($name);
$image = ImageCreateFromJPEG($name);
$images = ImageCreateTrueColor(1000, 1000);
ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, 1001, 1001, ImagesX($image), ImagesY($image));
ImageJPEG($images);
Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252