Reputation: 35
I want to know is there any inbuilt function in php through which I can display an image greater than the size stored in database(i.e. greater than the original size).
I know it can be done using the HTML/CSS properties height
and width
but I want it done through php only.
I tried imagecreatefromjpeg($filename);
but it takes file or directory name in place of $filename
and my image is in a database.
Here is a part of my code:
while( $result=mysqli_fetch_array($runquery))
{
echo'<img src="data:image/jpeg;base64,'base64_encode($result['image']).'"/>';
}
Upvotes: 2
Views: 368
Reputation: 1373
Load your image with imagecreatefromstring
. Then resize it with imagecopyresized
.
Also I would suggest you to only save the paths to your image in the database.
Upvotes: 2
Reputation: 3006
Get Imagick ready and call following function
bool Imagick::setImageExtent ( int $columns , int $rows )
Reference: Imagick::setImageExtent
Upvotes: 1