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
Tag: php
Can I safely delete all content in /var/lib/php5?
I have over 5 million session files in /var/lib/php5 I would like to delete all files in this folder using rm *, however I’m not sure if there are other files other than the session files in that …
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…
Can PHP cURL retrieve response headers AND body in a single request?
Is there any way to get both headers and body for a cURL request using PHP? I found that this option: is going to return the body plus headers, but then I need to parse it to get the body. Is there any way to get both in a more usable (and secure) way? Note that for “single request” I
PHP Error: ob_flush() [ref.outcontrol]: failed to flush buffer. No buffer to flush
Could someone please save these 2 files and run them and tell me why I get the error ” ob_flush() [ref.outcontrol]: failed to flush buffer. No buffer to flush”. I tried googling around and it says that I have to use ob_start(); but when I do then it doesn’t print out line by line, but rather…
RabbitMQ and Yii console callback error
I am trying to get RabbitMQ working with the Yii console in order to send transactional emails, but I am experiencing problems with getting the PHP-AMQPLib library to work within Yii. My code is …
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 …
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…
Check empty select in sqlite?
How can i check the result of my query? I try this, but when the result is empty – error doesn’t shows. Answer Note that sqlite_fetch_array() returns a result handle, not the number of rows, so you should not compare it against zero: This function will return a result handle or FALSE on failure. U…
Obtain first line of a string in PHP
In PHP 5.3 there is a nice function that seems to do what I want: Unfortunately, the server runs PHP 5.2.17 and the optional third parameter of strstr is not available. Is there a way to achieve this in previous versions in one line? Answer For the relatively short texts, where lines could be delimited by eit…