protected function processImages() { foreach ($this->encode_image_file_groups as $image_group) { /** @var $file RokBooster_Compressor_File */ $file = $image_group[0]; $image_group->setResult(base64_encode(file_get_contents($file->getPath()))); $oc = RokBooster_Compressor_OutputContainerFactory::create($image_group, $this->options); $oc->write(); $this->storeFileInfo($image_group); $this->finishedRendering($image_group); } }
/** * */ protected function populateInlineStyles() { $doc = JFactory::getDocument(); $doc->_style = array(); foreach ($this->inline_styles as $group) { $oc = RokBooster_Compressor_OutputContainerFactory::create($group, $this->options); if ($group->getStatus() == RokBooster_Compressor_IGroup::STATE_INCLUDE && $this->doesOutputExist($group, false)) { /** @var $group RokBooster_Compressor_InlineGroup */ $doc->addStyleDeclaration($oc->getContent(), $group->getMime()); } else { $doc->addStyleDeclaration($group->getContent(), $group->getMime()); } } }
protected function populateImages() { if ($this->options->convert_page_images) { $image_links = pq('img[src]', $this->document); foreach ($image_links as $image) { $attribs = pq($image, $this->document)->attr('*'); $src = $attribs['src']; if (array_key_exists($src, $this->imageFileGroups)) { $image_file_group = $this->imageFileGroups[$src]; $oc = RokBooster_Compressor_OutputContainerFactory::create($image_file_group, $this->options, false); if ($oc->doesExist(false)) { /** @var $image_file RokBooster_Compressor_File */ $image_file = $image_file_group[0]; $fileattribs = array(); foreach ($image_file->getAttributes() as $attrib_key => $attrib_value) { $fileattribs[] = $attrib_key . '="' . $attrib_value . '"'; } pq($image)->replaceWith(sprintf('<img src="data:%s;base64,%s" %s />', $image_file_group->getMime(), $oc->getContent($image_file_group), implode(' ', $fileattribs))); } } } } }