Dompdf Problem in CentOS

dompdf is an useful plugin to create html to pdf file. It works fine in windows environment but it creates some problem for some version of CentOS operating system. For example, it doesn’t show any error in the browser. To fix this problem, try the following:

  1. open terminal window/shell command window.
  2. run the command:- yum install php-xml
  3. run another command:- yum install php-mbstring

The above two commands setup two important packages which is mandatory for using dompdf plugins. There is a possibility that these two packages were already installed in your OS. No matter than. If everything goes okay, then I think your dompdf plugin will now work fine.

Increase Image Upload File Size Limit on OpenCart

OpenCart’s default image upload size is 300KB and that is simply too small for clients that don’t have the knowledge to resize their images before uploading them. Although uploading digital camera images does use more bandwidth, sometimes it can not be avoided. To adjust the image upload size make the following changes around line 436 of admin/controller/common/filemanager.php:

if ($this->request->files['image']['size'] > 3000000) {
	$json['error'] = $this->language->get('error_file_size');

In this case we have increased the upload size limit to 10MB, also make sure that your php configuration will allow file uploads and posts of this size.

Get Image from Post or Page

Add the following function in function.php which is present at the root of theme folder.

function catch_that_image()
global $post, $posts;
$first_img = '';
$output = preg_match_all('/<img.+src=['"]([^'"]+)['"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];

{ //Defines a default image
$first_img = "/images/default.jpg";
return $first_img;

Just call the function catch_that_image(), wherever you need to get the image from the article.

<img src="<?php echo catch_that_image();?>" width="75" height="75" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" align="left" hspace="5" />