Skip to content

Convert PDF to JPEG with PHP and ImageMagick

I’m using a litte script to convert PDF to JPG. That works but the quality is very poor. The script: One more thing, I want to keep the original size of the PDF but the conversion crops the size of the JPG. Answer It can be done using setResolution, but you need to do it before loading an image. Try

php-fpm and nginx session problems

I’ve been having this problem for the past week or so. I’ve been working on a PHP project that relies HEAVILY on Sessions. For some reason we’ve been having troubles with the sessions saving the past few days. Any idea why? Here’s the error: nginx version: PHP-FPM config: nginx.conf: A…

Using Default Arguments in a Function

I am confused about default values for PHP functions. Say I have a function like this: What if I want to use the default argument for $x and set a different argument for $y? I have been experimenting with different ways and I am just getting more confused. For example, I tried these two: But both of those do …

Check whether $_POST-value is empty

if(isset($_POST[‘submit’])) { if(!isset($_POST[‘userName’])) { $username = ‘Anonymous’; } else $username = $_POST[‘userName’]; } I cannot get the $username to be “Anonymous”?…

Get folder up one level

I am using this: echo dirname(__FILE__); which gives: C:UwAmpwwwmyfolderadmin However I am looking for path until: C:UwAmpwwwmyfolder from current script. How can that be done ?

Which version of php added anonymous functions

In manual there is create_function function and you can pass result from that function to array_map, I thought that that is the only way to have something like anonymous functions and closures, but then I found that I can just put function like in javascript In which version of php I can do this? Was this alw…