Tinymce wiris plugin image mode issue - php

I am using tinymce wiris plugin for entering equations for my project. Everything is working.
The equation I entering is previously saving as MATH ML format. It had some issue in chrome. So, I had to use mathjax for fix this issue. One of the project requirement was generating doc files. It also working fine except the math-ml equation. special characters are showing the doc file instead of the equation.
I googled and found that this the wiris have a imagemode option for saving the equation as image instead of MATH ML. It worked well in chrome. But still a broken image is showing in the doc file instead of equation image. Then I checked the
plugins/tiny_mce_wiris/integration/showimage.php?formula=4ee7dd91304079fd072d156593cce168&cw=95&ch=42&cb=23.
I checked the wiris and found that a png image is saving in the cache folder while creating the issue. I am guessing instead of the above showimage.php? script link as src, it is better to show the link of the generated png image.
Unfortunately I am not able to crack that part.
Please help if you have any ideas for that.
Thanks in advance

Related

How to make phpExcel to PDF doc fit in one page

I'm trying to save docs made by phpExcel into pdf format. Everything is fine, except for the fact that my file is very wide and doesn't fit in one page (so part of the data is lost behind the doc border)
I tried to use:
$phpExcel->getActiveSheet()->getPageSetup()->setFitToPage(true);
$phpExcel->getActiveSheet()->getPageSetup()->setFitToWidth(1);
$phpExcel->getActiveSheet()->getPageSetup()->setFitToHeight(0);
But nothing changed. (And as I understand these only works for print version, not for converting to PDF). Does anyone has any ideas how to improve that?
I solve this issue with the following command:
$phpExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3);

PDF to JPG with PHP unexpected behaviour

I'm using Imagick to convert all pages in a PDF to JPGs. But something is off, probably because of my lack of PDF knowledge.
The problem
The PDF I'm converting is a book. All pages turns out great except the cover page/first page. If I open the pdf in a PDF previewer it looks as it should but my converted image displays the cover page + a backside of the book. If I open the first page of the PDF in Illustrator I get the same result as my image. I also have a problem with some pdf's containing margins which is not displayed in a PDF previewer but as whitespace in my images.
But when converted to an image, the backside is white. It's like it doesn't exist but the image dimensions equals both of them.
Cause and Solution
Why does this happen and can I ignore the back somehow? Or should this be fixed in the PDF? Shit in shit out...
Code example
//...
$imagick->readImage('book.pdf[0]');
//...
file_put_contents('cover.jpg', $imagick):
Possible solution
Seems like if I use trimImage I get the expected result. So I have a bonus question. How does trimImage work? How does it know what to trim, let's say for example if I have a white image with text in the middle?
I managed to solve this and the solution was really simple. The solution is to use cropbox. You can set Imagick options by using setOption.
$imagick->setOption('pdf:use-cropbox', 'true');
Available options can be found here: http://www.imagemagick.org/script/command-line-options.php

Opencart images not showing after manual import

I have the following problem - I am migrating website database from other platform to Opencart.
When I imported the images in oc_product using PHP, they are not showing in the website. The real issue is that if I manually change or type the image path, it works. Maybe it's some cache problem, but I cannot figure out why.
The images are not showing even in the admin panel - attaching picture
Here is also how my database look like - the image path is correct
My Opencart version is 1.5.6.4
Any ideas?
obviously, the image path differs for the images, when we import and thus the imagepath has to be taken care before we actually import the data.And after importing then we have to run a sql query to change the imagepath in the database.
In the question you mention an import step performed using php.
I'm doing a wild guess but maybe that for whatever reason some unprintable character has been added and is messing up the whole thing.
The easiest way to check if this is the case is to analyze the html produced to verify if there is anything odd in the img tag path.
Another quick check is to export a few rows of data that are currently acting weird and analyze the content with a smart (that show special chars) text editor.

FCK editor renders image tag with strange slashes

I've been struggling with this for a while and I decided to ask for help. I don't understand why this is happening, when I use FCK editor to upload images and then I save the changes, the images are rendered with strange slashes. I don't know if this has to do with magic quotes (I'm using php to drive the site). Here's an example of the markup I'm talking about:
<img alt="\"\"" src="\"http://www.cesaisc.com/archivos_filemanager/image/esquema_preparatoria.jpg\"" style="\"width:" 890px;="" height:="" 489px;\"="">
As a result, obviously the image doesn't show up in the page.
¿Has anybody had this problem? I would appreciate some orientation as to why this is happening.
FCK editor sometimes requires to use stripslashes when outputing data, since it adds them before saving data to the DB.

Wordpress/php and base64 encoded images - jpeg works

I'm facing some problems, where i do not even have an idea how to get rid of those.
We moved our wordpress blog to a new server (Centos6, newest version of php, mysql).
We now noticed that a colleague just pasted many pictures into the wordpress editor, so that simply the base64 code is inserted into the article. This worked on the old server, but not on the new one.
If its an jpeg, it works like it used to. But if it's an png, all attributes are quotet with primes (”) and even the following normal elements are not working anymore.
This is how an element looks in the debugger:
<img class="”aligncenter”" alt="”"" src="”data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl...”">
I checked my first ideas like mime types, but nothing helped. Then I updated php on the old server - There it still works.
The encoding of the files seem to be us-ascii (same on the old server).
The funny thing is - it works in the backend, but not in the frontend.
I have no idea. Any hints appreciated,
Best,
Kddc

Categories