Howto: Image Output From Joomla 1.5

Now I know how to output image or any other type from Joomla 1.5. Before this I've already made my extension to output image from Joomla in the hard way, I simply use die(); to cancel all others html ouput from Joomla. Since I can't find any tutorial on how to done this things in internet.

So, first thing I looked up to is how to make Joomla print out RAW data. In the older version, we may use 'no_html=1' in our request, for example append this after your server url ( http://joomlaserver/ ):

index.php?option=com_extension&no_html=1

index.php?option=com_extension&format=raw

First line above will tell Joomla 1.0 not to output any HTML but the component's output. Use one of those two lines above to tell Joomla 1.5 to output anything the component wants to print out as is without any Joomla's header or footer.

After I've figured it out how to do raw print out, my second task is to make my component print out its own header. So I add this line of code ( in my case, it'll output jpeg image on the fly ):

header("Content-type: image/jpeg");
header('Content-Disposition: inline; filename=image.jpg');
header("Pragma: no-cache");
header("Expires: 0");
echo $myImageBinarySource;

And I'll get my image output from Joomla 1.5 framework in clean and clear code.

Joomla's Non-standard Output Header

Technorati Tags: ,,,

As we all know, all joomla's output mainly grouped into 4: HTML, PDF, Feed, RAW. What about if I'd like to output anything else directly from Joomla? You just have to die();

Every output in Joomla will have extra HTML elements, for now I use this trick: Output all header that you need, print out your content and finally before Joomla get in the way, execute die(). This solves my problem.

For example, try to do this in model. Since in model is where you put your data[base] management:

header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=MyFile.xls");
header("Pragma: no-cache");
header("Expires: 0");
die();

I still think this is not the right way, untill then, enjoy this..

2018: Tahun Baru Motivasi Baru

Tahun Baru 2017 sudah lewat, sekarang sudah 2018. Tahun berganti seperti yang sudah-sudah, setahun lagi juga akan berganti menjadi 2019. ...