Cakephp - Dynamicly save multiple jqplot images - php

I need to render and save multiple charts as images in a single function.
I already created the function to render the image. Also using javascript and ajax I made a functions to convert the graph to image and save it on the server (also adding watermark and text). But this works for 1 chart that you are viewing at the moment. What if I would like to save many charts in a single view?

Since the JQPLot chart is rendered on the client, The only option you have is to generate each chart, perhaps in a hidden div, convert it into a PNG file which you can later send to the server.
Or you can generate png's at runtime using js and keep on adding them to probably a comma separated hidden variable.

Related

How to generate single PDF of page that contained multiple highcharts in DIVs

I am generating multiple report charts in a single page and need to convert the same page into pdf and image.
Is it possible to create pdf same as the HTML?
JavaScript and html codes are below:
$('#containerBar').highcharts({
chart: {
type: 'bar'
},
xAxis: {
categories: ['National Lottery', 'Ready Steady Cook', 'Vicar of Dibley']
},
........
containerBar is on div id in side the page there is numbers of div containing chart.
http://www.cloudformatter.com/CSS2Pdf.SVGCharts.HighCharts shows this exact example. It uses a javascript in page to extract the content of a div or multiple div elements to produce pdf.
Yes it is, but i do not think it is possible with highcharts itself.
I think you need to use a 3rd party library to generate PDFs.
I use mPDF for that. you simply set up the PHP library, and paste the geenrated HTML page. you can embed your charts using the highcharts export server
It may be a little work, but it works.
By using only highcharts i doubt it is possible.
UPDATE - or you can simply use some automated generator like this one:
pdfcrowd.com
you can simply post your html page there and get the PDF

PhpChart as flat image

Is there a way to generate a flat image of my graph made with PhpChart in Php?
I know I can get the image in javascript using $(this).jqplotToImageElem(); but this doesn't help as I need to be able to put it into a PDF document I am creating in Php. I have tried using ajax to save the file to the server but the request URI is too long, so I really just need to generate the flat image in Php.
I thought I would write what work around I did for this in case anyone has the same issue. I created a POST form with a hidden input and once the page with the chart on it was loaded I used jQuery to put $(this).jqplotToImageElem().src; into the value of that input and then submit the form to the page needing the image. The receiving page can then use <img src="<?php $_POST['imagesrc'] ?>" /> to show the flat image of the chart, in my case I used the src in my pdf document.

Is it possible to show some php content inside an html image?

Is it possible to display some php content within an HTML image (say display on the screen of an iPhone where iPhone being an image)
Well, if you just want to overlay text on an image, why create an image at all.
you can use css background image(iphone in this case) for a div and the insert your phpp content as a child of that div. Using proper css styling and positioning, you will get your desired look. Its simple and less server consuming than going the image creation way.
You could generate your own image on the server using the GD library to overlay your content onto the image and then send that to the client.
You can use CSS to achieve the same effect, without requiring any server processing; however, it must be an image, you might want to check out the image processing library that allows you to manipulate images using PHP http://php.net/manual/en/book.image.php.

How to add a text with font to an image using jquery and PHP

I want to add editable text (with font selection) to an image using jquery and want this to be saved as a new image.
Can someone give me some examples or opensource tools for this?
To Explain further, jquery would be used to write text and select font over an image and in the server side PHP can be used to save the new image. I have already developed some server side coding to do the same but looking for a jquery solution for the front end.
The only way you can do this is to use canvas and "save as image", but canvas is not well supported - so if a public website then not recommended. Link: http://www.html5canvastutorials.com/advanced/html5-canvas-save-drawing-as-an-image/
Otherwise you need to do as two separate actions - write the text for display as jQuery, then recreate the image using GD library in PHP. You'll struggle to get them identical, but they can get pretty close.

Filling a PDF template with PHP

I have a PDF file that functions as a template containing only textboxes. Is there any way I can fill the fields in via PHP? I have found examples of how to directly draw onto a PDF document when given x,y values, but I want to put values into my textboxes rather than doing that.
Sourabh's link showed that this is impossible in Android, I'm reverting to using a HTML document with filler where the textboxs in the PDF were and replacing them in code.

Categories