Closed (works as designed)
Project:
Vertical Print
Version:
5.x-1.0
Component:
Miscellaneous
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
25 May 2009 at 04:41 UTC
Updated:
27 May 2009 at 15:36 UTC
Hi,
I have custom function in which i receive some text, In that function i want to print generated image.
function myfunction($text){
$output = '';
$output .= 'here i want to print that generated image';
return $output;
}
So in above how can i print generated image or using AJAX or Jquery.
Thanks,
Comments
Comment #1
DougKress commentedYou can generate the image similarly to the code above by calling module_invoke('vprint', 'dump_image', $size, $text, $maxsize) - this generates the image and sends it to the client (setting the content-type to image/png - see source code).
From javascript - simply call the vprint URL.
If you actually want the binary string that makes up the image - you can look at the vprint_dump_image() function to see how.
Does that answer your question?
- Doug
Comment #2
kuldip zala commentedHi,
It will display just image on that path with no-sidebar,header,etc... But i want something like
Comment #3
DougKress commentedTry:
You can't actually embed the image data along with the initial page call - it's always a call-back to load the image. The browser wouldn't know how to process the data in-line.
- Doug
Comment #4
kuldip zala commentedNothing is print.
tag call vprint function.
Check with firebug in mozilla so that you can identify easily.
Method that you given is totally wrong. How can
Comment #5
DougKress commentedIf you have the module enabled and turned on, the tag is exactly how you call it - it's how it was designed to be used.
The problem with your original request is that you cannot combine text with the actual image file contents - the browser would have no idea how to process it, and it would just end up being gibberish.
However, if you use the URL in an image tag, the browser will display the text and fetch the image, displaying it appropriately, just like any image tag. Here's some HTML that links to a working site - if you copy and paste this into a .html file and open it, you should see the image:
You can also print those three lines from PHP to have the same effect.
To host this on your site, simply install and enable the vprint module, and use a relative reference instead of an absolute reference, as stated in my previous example.
- Doug