• Ogłoszenie:

Creating pdf thumbnail in php and caching it

Wszystko odnośnie tworzenia grafiki - obróbka, problemy, oceny.
Tworzenia Stron internetowych - HTML, PHP, MySQL...

Creating pdf thumbnail in php and caching it

Postprzez MahishTanzon 16 Sty 2023, 09:51

reklama
I'm using a generic PHP based CMS, i wanted to create a script which read the pdf created a thumbnail and cached it. There were lots of different answers, and i did have a fair few problems with different versions of imagick, but this is script which worked for me.

some people might find it useful and maybe someone omegle shagle could advice me if it is optimised?

<?php

$loc = *the file location*;
$pdf = *the file name*;
$format = "jpg";
$dest = "$loc$pdf.$format";

if (file_exists($dest))
{
$im = new imagick();
$im->readImage($dest);
header( "Content-Type: image/jpg" );
echo $im;
exit;
}
else
{
$im = new imagick($loc.$pdf.'[0]');
$im->setImageFormat($format);

$width = $im->getImageheight();
$im->cropImage($width, $width, 0, 0);
$im->scaleImage(110, 167, true);

$im->writeImage($dest);

header( "Content-Type: image/jpg" );
echo $im;
exit;
}

?>
Ostatnio edytowany przez MahishTanzon, 03 Lut 2023, 06:36, edytowano w sumie 1 raz
MahishTanzon
~user
 
Posty: 28
Dołączenie: 29 Gru 2022, 15:04



Creating pdf thumbnail in php and caching it

Postprzez playsolitaireaz 02 Lut 2023, 08:50

I've seen children as young as 8 years old playing the game referred to as cookie clicker. You can tell a lot about people through their voices. Because they don't actually play the game in a competitive manner and they occasionally simply do whatever they want in it, they can be quite unpleasant. They also tend to make a lot of noise. Uninterrupted yelling and talking both. Yes.
playsolitaireaz
~user
 
Posty: 2
Dołączenie: 02 Lut 2023, 08:40




Powróć do Grafika & Webmastering

Kto jest na forum

Użytkownicy przeglądający to forum: Brak zarejestrowanych użytkowników oraz 2 gości