You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Anish <an...@techblue.co.uk> on 2009/10/21 14:18:44 UTC

Modifying MIME-TYPE with ImageReader

Hi All

I want to use ImageReader to read jpg images (from file) and then to 
serve as gif (or any other format like png, tiff etc). I'm unable to 
find solution for that.

Please suggest and let me know how I can modify/convert mime-type for 
the response.



TIA

-- 
Anish Sneh
Software Engineer
Techblue Softwares Pvt. Ltd.
www.technologyblueprint.co.uk




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Luca Morandini <lm...@ieee.org>.
On 22/10/09 15:28, Gaurav Kalia wrote:
>
> I am saving the image which has been transformed by my CustomReader at
> physical location and i can see that the JPG image got converted into
> GIF Image which is exactly what i want but when this GIF image stream is
> passed to Cocoon code it gets transformed back to JPG.

Excuse me: but is the entire stream "transformed back" into JPEG or is just the 
mime-type that is not coherent with the (transformed) GIF stream ?

Regards,

--------------------
    Luca Morandini
www.lucamorandini.it
--------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Anish <an...@techblue.co.uk>.
> Hi Gaurav/Anish
>
> Can you make sure that you are not passing the image info of source 
> image into your code?
>
> You have to change the image info according to GIF image as well as 
> you are converting JPG to GIF.

Thanks Sachin, it worked..... :-)

As we used ImageInfo object according to the GIF format, it returned us 
proper GIF file on the browser.




sac sha wrote:
> Hi Gaurav/Anish
>
> Can you make sure that you are not passing the image info of source 
> image into your code?
>
> You have to change the image info according to GIF image as well as 
> you are converting JPG to GIF.
>
> Thanks
> Sac
>
> On Fri, Oct 23, 2009 at 1:40 AM, Luca Morandini <lmorandini@ieee.org 
> <ma...@ieee.org>> wrote:
>
>     On 22/10/09 23:44, Thorsten Scherler wrote:
>
>
>         On 22/10/2009, at 21:32, Luca Morandini wrote:
>
>             Yep... although it could be even easier to test: since the
>             (untransformed) JPEG is square and the (transformed) GIF
>             is circular,
>             what's needed is just checking the transparency of the
>             background.
>
>
>         That would not matter. Since the underlying gif does not exist
>         but it is
>         the transformed jpg would be interesting what the browser
>         thinks (we
>         trick him into eating the correct extension). Further you said
>         transparency is not allowed in jpg so if you see transparency
>         what does
>         that mean?
>
>
>     One note: I am *not* the user who posted this issue, that is
>     Gaurav, not me.
>
>     Anyway, I just wanted to make sure the returned image is the
>     transformed one, in order to exclude any issue with the custom
>     reader Gaurav developed.
>
>
>     Regards,
>
>
>     --------------------
>       Luca Morandini
>     www.lucamorandini.it <http://www.lucamorandini.it>
>     --------------------
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>     <ma...@cocoon.apache.org>
>     For additional commands, e-mail: users-help@cocoon.apache.org
>     <ma...@cocoon.apache.org>
>
>
>
>
> -- 
> Regards
> Sachin Sharma
>


-- 
Anish Sneh
Software Engineer
Techblue Softwares Pvt. Ltd.
www.technologyblueprint.co.uk




Re: Modifying MIME-TYPE with ImageReader

Posted by sac sha <sa...@gmail.com>.
Hi Gaurav/Anish

Can you make sure that you are not passing the image info of source image
into your code?

You have to change the image info according to GIF image as well as you are
converting JPG to GIF.

Thanks
Sac

On Fri, Oct 23, 2009 at 1:40 AM, Luca Morandini <lm...@ieee.org> wrote:

> On 22/10/09 23:44, Thorsten Scherler wrote:
>
>>
>> On 22/10/2009, at 21:32, Luca Morandini wrote:
>>
>>  Yep... although it could be even easier to test: since the
>>> (untransformed) JPEG is square and the (transformed) GIF is circular,
>>> what's needed is just checking the transparency of the background.
>>>
>>
>> That would not matter. Since the underlying gif does not exist but it is
>> the transformed jpg would be interesting what the browser thinks (we
>> trick him into eating the correct extension). Further you said
>> transparency is not allowed in jpg so if you see transparency what does
>> that mean?
>>
>
> One note: I am *not* the user who posted this issue, that is Gaurav, not
> me.
>
> Anyway, I just wanted to make sure the returned image is the transformed
> one, in order to exclude any issue with the custom reader Gaurav developed.
>
> Regards,
>
>
> --------------------
>   Luca Morandini
> www.lucamorandini.it
> --------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


-- 
Regards
Sachin Sharma

Re: Modifying MIME-TYPE with ImageReader

Posted by Luca Morandini <lm...@ieee.org>.
On 22/10/09 23:44, Thorsten Scherler wrote:
>
> On 22/10/2009, at 21:32, Luca Morandini wrote:
>
>> Yep... although it could be even easier to test: since the
>> (untransformed) JPEG is square and the (transformed) GIF is circular,
>> what's needed is just checking the transparency of the background.
>
> That would not matter. Since the underlying gif does not exist but it is
> the transformed jpg would be interesting what the browser thinks (we
> trick him into eating the correct extension). Further you said
> transparency is not allowed in jpg so if you see transparency what does
> that mean?

One note: I am *not* the user who posted this issue, that is Gaurav, not me.

Anyway, I just wanted to make sure the returned image is the transformed one, in 
order to exclude any issue with the custom reader Gaurav developed.

Regards,


--------------------
    Luca Morandini
www.lucamorandini.it
--------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Thorsten Scherler <th...@apache.org>.
On 22/10/2009, at 21:32, Luca Morandini wrote:

> On 22/10/09 18:30, Rainer Pruy wrote:
>>
>> still all doubts are around "e":
>
> I do agree.
>
>
>> A simple test in the meantime would be changing the request to call  
>> for "test.gif"
>> and compare the results.
>
> Yep... although it could be even easier to test: since the  
> (untransformed) JPEG is square and the (transformed) GIF is  
> circular, what's needed is just checking the transparency of the  
> background.

That would not matter. Since the underlying gif does not exist but it  
is the transformed jpg would be interesting what the browser thinks  
(we trick him into eating the correct extension). Further you said  
transparency is not allowed in jpg so if you see transparency what  
does that mean?

>
>
>> Requesting JPG and getting GIF troubles a lot of potential clients.
>> Would it be possible to make a request for .gif in the necessary  
>> cases.
>
> To avoid trobule, I suppose every image should be converted to GIF,  
> whether this transformation is needed or not; or, possibly, two  
> separate pipelines (assuming one can tell the image to convert from  
> the one not to convert *before* requesting it).


Agree, see above.

salu2



Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Luca Morandini <lm...@ieee.org>.
On 22/10/09 18:30, Rainer Pruy wrote:
>
> still all doubts are around "e":

I do agree.


> A simple test in the meantime would be changing the request to call for "test.gif"
> and compare the results.

Yep... although it could be even easier to test: since the (untransformed) JPEG is 
square and the (transformed) GIF is circular, what's needed is just checking the 
transparency of the background.


> Requesting JPG and getting GIF troubles a lot of potential clients.
> Would it be possible to make a request for .gif in the necessary cases.

To avoid trobule, I suppose every image should be converted to GIF, whether this 
transformation is needed or not; or, possibly, two separate pipelines (assuming 
one can tell the image to convert from the one not to convert *before* requesting it).

Regards,

--------------------
    Luca Morandini
www.lucamorandini.it
--------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Rainer Pruy <Ra...@Acrys.COM>.
hi

the whole conversation still looks to me like talking cross-purposes.

What I did understand is going on:

a) A client (your browser or a software component) is requesting "test.jpg" from a cocoon based server
b) the request does match your pipeline
c) your customreader is being called
   it reads a jpg image and generates a byte stream forming a GIF image.
d) the stream is being labeled with mime type "image/gif"
e) the data stream is received by the calling client and is deemed to be JPG

You already verified:
- a and b are happening as expected
- c is executed as expected
- d is true

still all doubts are around "e":

is it a GIF or a JPG image byte stream.

This can not be told easily from a browser as some browser
tend not to follow http mime type information.

Thus be aware that a browser might tell you "it is a JPG image"
just because it recognized a jpg suffix, while the display component will detect a GIF byte stream that it can handle correctly
and you will happily look at an image the browser makes you believe is JPG.

Thus, again, what is received at "e"?
(not in terms of mime type - but in terms of actual byte stream)

A simple test in the meantime would be changing the request to call for "test.gif"
and compare the results.

And you probably should reconsider your request logic:
Requesting JPG and getting GIF troubles a lot of potential clients.
Would it be possible to make a request for .gif in the necessary cases.

A clean approach would be requesting just "test" (without suffix).
However, it has nearly the same pitfalls as using a "wrong" suffix,
as there is still lots of software around that assumes knowing what a file must be as long as it knows the suffix.

Regards,
Rainer


Gaurav Kalia schrieb:
>> What, exactly, comes back to the browser ? 
> 2) A correct JPEG image, visibile on the browser
> 
>> Moreover, a look at the HTTP headers (both request and response) will
>> help sorting this out
> I will look into the header and will post it here.
>> I don't see the point of a client requesting a JPEG image and
>> receiving a GIF one instead
> 
> This is because in my CustomReader i am modifying the image like
> converting a rectangular image into circular image and making the rest
> of the part other then the circular image transparent and JPG images
> does not transparency i guess.
> 
> This is the reason i am converting the JPG image into GIF.
> 
> Regards
> Gaurav
> 
> 
> 
> 
> 
> Luca Morandini wrote:
>> On 22/10/09 16:19, Gaurav Kalia wrote:
>>> Yes, On the browser the image is coming as JPG format but it should come
>>> as GIF Format as transformed by my CustomReader Class.
>>
>> What, exactly, comes back to the browser ?
>>
>> 1) A GIF image mistaken for a JPEG one, hence appearing as a broken
>> image on the browser
>> 2) A correct JPEG image, visibile on the browser
>> 3) A correct GIF image, but with the mime-type of a JPEG
>> 4) Other...
>>
>> Moreover, a look at the HTTP headers (both request and response) will
>> help sorting this out.
>>
>> To be honest, I don't see the point of a client requesting a JPEG
>> image and receiving a GIF one instead... but I suppose it makes a
>> business case of sort.
>>
>> Regards,
>>
>> --------------------
>>    Luca Morandini
>> www.lucamorandini.it
>> --------------------
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

-- 
Rainer Pruy
Geschäftsführer

Acrys Consult GmbH & Co. KG
Theodor-Heuss-Str. 53-63, D-61118 Bad Vilbel
Tel: +49-6101-98760-0 Fax: +49-6101-98760-50
Web: http://www.acrys.com -  Email: office@acrys.com
Handelsregister: Frankfurt am Main, HRA 31151
Komplementärin: Acrys Verwaltungs GmbH
Theodor-Heuss-Str. 53-63, D-61118 Bad Vilbel
Handelsregister: Frankfurt am Main, HRB 57625

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Gaurav Kalia <ga...@techblue.co.uk>.
> What, exactly, comes back to the browser ? 
2) A correct JPEG image, visibile on the browser

> Moreover, a look at the HTTP headers (both request and response) will 
> help sorting this out
I will look into the header and will post it here.
> I don't see the point of a client requesting a JPEG image and 
> receiving a GIF one instead

This is because in my CustomReader i am modifying the image like 
converting a rectangular image into circular image and making the rest 
of the part other then the circular image transparent and JPG images 
does not transparency i guess.

This is the reason i am converting the JPG image into GIF.

Regards
Gaurav





Luca Morandini wrote:
> On 22/10/09 16:19, Gaurav Kalia wrote:
>> Yes, On the browser the image is coming as JPG format but it should come
>> as GIF Format as transformed by my CustomReader Class.
>
> What, exactly, comes back to the browser ?
>
> 1) A GIF image mistaken for a JPEG one, hence appearing as a broken 
> image on the browser
> 2) A correct JPEG image, visibile on the browser
> 3) A correct GIF image, but with the mime-type of a JPEG
> 4) Other...
>
> Moreover, a look at the HTTP headers (both request and response) will 
> help sorting this out.
>
> To be honest, I don't see the point of a client requesting a JPEG 
> image and receiving a GIF one instead... but I suppose it makes a 
> business case of sort.
>
> Regards,
>
> --------------------
>    Luca Morandini
> www.lucamorandini.it
> --------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Luca Morandini <lm...@ieee.org>.
On 22/10/09 16:19, Gaurav Kalia wrote:
> Yes, On the browser the image is coming as JPG format but it should come
> as GIF Format as transformed by my CustomReader Class.

What, exactly, comes back to the browser ?

1) A GIF image mistaken for a JPEG one, hence appearing as a broken image on the 
browser
2) A correct JPEG image, visibile on the browser
3) A correct GIF image, but with the mime-type of a JPEG
4) Other...

Moreover, a look at the HTTP headers (both request and response) will help sorting 
this out.

To be honest, I don't see the point of a client requesting a JPEG image and 
receiving a GIF one instead... but I suppose it makes a business case of sort.

Regards,

--------------------
    Luca Morandini
www.lucamorandini.it
--------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Gaurav Kalia <ga...@techblue.co.uk>.
Hi,

> what do you mean with "when this GIF image stream is passed to Cocoon code it gets transformed back to JPG"?
In my CustomReader Class I am just overriding the method processStream() 
of ImageReader Class. And in the processStream() of my CustomeReader 
Class, I am transforming the JPG image into GIF image. I have checked 
mime-type of the image which has been transformed by my CustomeReader 
Class, it is image/gif.

> do you mean your browser is indicating the file received being JPG or even your OS bluntly assumes a file named '*.jpg' being JPG?
Yes, On the browser the image is coming as JPG format but it should come 
as GIF Format as transformed by my CustomReader Class.

> Did you actually verify the format of the file received being JPG?
Yes i have checked the mime type of the image.

Gaurav

Rainer Pruy wrote:
> Hi,
>
> what do you mean with "when this GIF image stream is passed to Cocoon code it gets transformed back to JPG"?
>
> If you gave the complete pipeline, there is no other cocoon component involved that could run a conversion from GIF to JPG.
> Or do you mean your browser is indicating the file received being JPG or even your OS bluntly assumes a file named '*.jpg' being JPG?
>
> Be aware, that your browser probably does give more trust in the URL ending with '.jpg' than the actual mime type being indicated by
> cocoon. This way tricking you in believing you did get JPG.
>
> Did you actually verify the format of the file received being JPG?
>
> Rainer
>
> Gaurav Kalia schrieb:
>   
>>> For that matter, you can set it in the pipelines, like:
>>>       <map:match pattern="favicon.ico">
>>>         <map:read src="resource/external/images/favicon.ico"
>>> mime-type="image/vnd.microsoft.icon"/>
>>>       </map:match> 
>>>       
>> This is the pipeline we are using:
>>
>>    <map:match pattern="test.jpg">
>>            <map:read type="customreader"
>> src="/home/user/Desktop/test.jpg" mime-type="image/gif">
>>                <map:parameter name="width" value="250"/>
>>                <map:parameter name="height" value="160"/>
>>            </map:read>
>>        </map:match>
>>
>> Here we are using JPG image in the src and the mime-type is set to
>> image/gif. CustomReader is our reader which is transforming the image
>> and converting it into GIF image.
>>
>> I am saving the image which has been transformed by my CustomReader at
>> physical location and i can see that the JPG image got converted into
>> GIF Image which is exactly what i want but when this GIF image stream is
>> passed to Cocoon code it gets transformed back to JPG.
>>
>> I am trying to find that piece of code which is transforming the image
>> back to JPG after my CustomReader.
>>
>> Please Suggest
>>
>> Luca Morandini wrote:
>>     
>>> On 21/10/09 18:11, Anish wrote:
>>>       
>>>> But the problem is that when the gif stream is generated by our modified
>>>> image reader, somewhere in the code Cocoon automatically converts its
>>>> mime type to JPEG and again returns a JPEG image irrespective of the
>>>> required mime-type.
>>>>         
>>> For that matter, you can set it in the pipelines, like:
>>>       <map:match pattern="favicon.ico">
>>>         <map:read src="resource/external/images/favicon.ico"
>>> mime-type="image/vnd.microsoft.icon"/>
>>>       </map:match>
>>>       <map:match pattern="*.png">
>>>         <map:read src="resource/external/images/{1}.png"
>>> mime-type="image/png"/>
>>>       </map:match>
>>> ...etc
>>>
>>> --------------------
>>>    Luca Morandini
>>> www.lucamorandini.it
>>> --------------------
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Rainer Pruy <Ra...@Acrys.COM>.
Hi,

what do you mean with "when this GIF image stream is passed to Cocoon code it gets transformed back to JPG"?

If you gave the complete pipeline, there is no other cocoon component involved that could run a conversion from GIF to JPG.
Or do you mean your browser is indicating the file received being JPG or even your OS bluntly assumes a file named '*.jpg' being JPG?

Be aware, that your browser probably does give more trust in the URL ending with '.jpg' than the actual mime type being indicated by
cocoon. This way tricking you in believing you did get JPG.

Did you actually verify the format of the file received being JPG?

Rainer

Gaurav Kalia schrieb:
>> For that matter, you can set it in the pipelines, like:
>>       <map:match pattern="favicon.ico">
>>         <map:read src="resource/external/images/favicon.ico"
>> mime-type="image/vnd.microsoft.icon"/>
>>       </map:match> 
> This is the pipeline we are using:
> 
>    <map:match pattern="test.jpg">
>            <map:read type="customreader"
> src="/home/user/Desktop/test.jpg" mime-type="image/gif">
>                <map:parameter name="width" value="250"/>
>                <map:parameter name="height" value="160"/>
>            </map:read>
>        </map:match>
> 
> Here we are using JPG image in the src and the mime-type is set to
> image/gif. CustomReader is our reader which is transforming the image
> and converting it into GIF image.
> 
> I am saving the image which has been transformed by my CustomReader at
> physical location and i can see that the JPG image got converted into
> GIF Image which is exactly what i want but when this GIF image stream is
> passed to Cocoon code it gets transformed back to JPG.
> 
> I am trying to find that piece of code which is transforming the image
> back to JPG after my CustomReader.
> 
> Please Suggest
> 
> Luca Morandini wrote:
>> On 21/10/09 18:11, Anish wrote:
>>>
>>> But the problem is that when the gif stream is generated by our modified
>>> image reader, somewhere in the code Cocoon automatically converts its
>>> mime type to JPEG and again returns a JPEG image irrespective of the
>>> required mime-type.
>>
>> For that matter, you can set it in the pipelines, like:
>>       <map:match pattern="favicon.ico">
>>         <map:read src="resource/external/images/favicon.ico"
>> mime-type="image/vnd.microsoft.icon"/>
>>       </map:match>
>>       <map:match pattern="*.png">
>>         <map:read src="resource/external/images/{1}.png"
>> mime-type="image/png"/>
>>       </map:match>
>> ...etc
>>
>> --------------------
>>    Luca Morandini
>> www.lucamorandini.it
>> --------------------
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

-- 
Rainer Pruy
Geschäftsführer

Acrys Consult GmbH & Co. KG
Theodor-Heuss-Str. 53-63, D-61118 Bad Vilbel
Tel: +49-6101-98760-0 Fax: +49-6101-98760-50
Web: http://www.acrys.com -  Email: office@acrys.com
Handelsregister: Frankfurt am Main, HRA 31151
Komplementärin: Acrys Verwaltungs GmbH
Theodor-Heuss-Str. 53-63, D-61118 Bad Vilbel
Handelsregister: Frankfurt am Main, HRB 57625

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Gaurav Kalia <ga...@techblue.co.uk>.
> For that matter, you can set it in the pipelines, like:
>       <map:match pattern="favicon.ico">
>         <map:read src="resource/external/images/favicon.ico" 
> mime-type="image/vnd.microsoft.icon"/>
>       </map:match> 
This is the pipeline we are using:

    <map:match pattern="test.jpg">
            <map:read type="customreader" 
src="/home/user/Desktop/test.jpg" mime-type="image/gif">
                <map:parameter name="width" value="250"/>
                <map:parameter name="height" value="160"/>
            </map:read>
        </map:match>

Here we are using JPG image in the src and the mime-type is set to 
image/gif. CustomReader is our reader which is transforming the image 
and converting it into GIF image.

I am saving the image which has been transformed by my CustomReader at 
physical location and i can see that the JPG image got converted into 
GIF Image which is exactly what i want but when this GIF image stream is 
passed to Cocoon code it gets transformed back to JPG.

I am trying to find that piece of code which is transforming the image 
back to JPG after my CustomReader.

Please Suggest

Luca Morandini wrote:
> On 21/10/09 18:11, Anish wrote:
>>
>> But the problem is that when the gif stream is generated by our modified
>> image reader, somewhere in the code Cocoon automatically converts its
>> mime type to JPEG and again returns a JPEG image irrespective of the
>> required mime-type.
>
> For that matter, you can set it in the pipelines, like:
>       <map:match pattern="favicon.ico">
>         <map:read src="resource/external/images/favicon.ico" 
> mime-type="image/vnd.microsoft.icon"/>
>       </map:match>
>       <map:match pattern="*.png">
>         <map:read src="resource/external/images/{1}.png" 
> mime-type="image/png"/>
>       </map:match>
> ...etc
>
> --------------------
>    Luca Morandini
> www.lucamorandini.it
> --------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Luca Morandini <lm...@ieee.org>.
On 21/10/09 18:11, Anish wrote:
>
> But the problem is that when the gif stream is generated by our modified
> image reader, somewhere in the code Cocoon automatically converts its
> mime type to JPEG and again returns a JPEG image irrespective of the
> required mime-type.

For that matter, you can set it in the pipelines, like:
       <map:match pattern="favicon.ico">
         <map:read src="resource/external/images/favicon.ico" 
mime-type="image/vnd.microsoft.icon"/>
       </map:match>
       <map:match pattern="*.png">
         <map:read src="resource/external/images/{1}.png" mime-type="image/png"/>
       </map:match>
...etc

--------------------
    Luca Morandini
www.lucamorandini.it
--------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Anish <an...@techblue.co.uk>.
> That's not only a matter of mime-type. It also means signal 
> transcoding. You could have a look at ImageMagick for that.

??Andre, Sorry I think my post is a bit confusing. Let me make it more 
clear.

Actually we are working on the implementation of JMagick for reading 
images in Cocoon. We also have posted a patch for that (bug link 
https://issues.apache.org/jira/browse/COCOON-2269)

But the problem is that when the gif stream is generated by our modified 
image reader, somewhere in the code Cocoon automatically converts its 
mime type to JPEG and again returns a JPEG image irrespective of the 
required mime-type.

We're not sure where cocoon sets the mime type.


Please suggest




André Davignon wrote:
> That's not only a matter of mime-type. It also means signal 
> transcoding. You could have a look at ImageMagick for that.
>
> André
>
>
>>
>>> As far as I am aware - the cocoon image reader does not transform 
>>> anything other than jpeg images. 
>>
>> Yes sir, but we wanted to search that block of code which actually 
>> sets mime-type of the response to JPEG.
>>
>>
>> Please suggest.
>>
>>
>>
>> Vik Tara wrote:
>>> On 21/10/09 13:18, Anish wrote:
>>>> Hi All
>>>>
>>>> I want to use ImageReader to read jpg images (from file) and then 
>>>> to serve as gif (or any other format like png, tiff etc). I'm 
>>>> unable to find solution for that.
>>>>
>>>> Please suggest and let me know how I can modify/convert mime-type 
>>>> for the response.
>>> As far as I am aware - the cocoon image reader does not transform 
>>> anything other than jpeg images.
>>>
>>> See bugs/caveats in the documentation:
>>> http://cocoon.apache.org/2.1/userdocs/core/image-reader.html
>>>
>>>
>>> Regards
>>>
>>>
>>> Vik
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


-- 
Anish Sneh
Software Engineer
Techblue Softwares Pvt. Ltd.
www.technologyblueprint.co.uk




Re: Modifying MIME-TYPE with ImageReader

Posted by André Davignon <an...@free.fr>.
That's not only a matter of mime-type. It also means signal transcoding. 
You could have a look at ImageMagick for that.

André


>
>> As far as I am aware - the cocoon image reader does not transform 
>> anything other than jpeg images. 
>
> Yes sir, but we wanted to search that block of code which actually 
> sets mime-type of the response to JPEG.
>
>
> Please suggest.
>
>
>
> Vik Tara wrote:
>> On 21/10/09 13:18, Anish wrote:
>>> Hi All
>>>
>>> I want to use ImageReader to read jpg images (from file) and then to 
>>> serve as gif (or any other format like png, tiff etc). I'm unable to 
>>> find solution for that.
>>>
>>> Please suggest and let me know how I can modify/convert mime-type 
>>> for the response.
>> As far as I am aware - the cocoon image reader does not transform 
>> anything other than jpeg images.
>>
>> See bugs/caveats in the documentation:
>> http://cocoon.apache.org/2.1/userdocs/core/image-reader.html
>>
>>
>> Regards
>>
>>
>> Vik
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Anish <an...@techblue.co.uk>.
> As far as I am aware - the cocoon image reader does not transform 
> anything other than jpeg images. 

Yes sir, but we wanted to search that block of code which actually sets 
mime-type of the response to JPEG.


Please suggest.



Vik Tara wrote:
> On 21/10/09 13:18, Anish wrote:
>> Hi All
>>
>> I want to use ImageReader to read jpg images (from file) and then to 
>> serve as gif (or any other format like png, tiff etc). I'm unable to 
>> find solution for that.
>>
>> Please suggest and let me know how I can modify/convert mime-type for 
>> the response.
> As far as I am aware - the cocoon image reader does not transform 
> anything other than jpeg images.
>
> See bugs/caveats in the documentation:
> http://cocoon.apache.org/2.1/userdocs/core/image-reader.html
>
>
> Regards
>
>
> Vik
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


-- 
Anish Sneh
Software Engineer
Techblue Softwares Pvt. Ltd.
www.technologyblueprint.co.uk




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Vik Tara <vi...@propco.co.uk>.
On 21/10/09 13:18, Anish wrote:
> Hi All
>
> I want to use ImageReader to read jpg images (from file) and then to 
> serve as gif (or any other format like png, tiff etc). I'm unable to 
> find solution for that.
>
> Please suggest and let me know how I can modify/convert mime-type for 
> the response.
As far as I am aware - the cocoon image reader does not transform 
anything other than jpeg images.

See bugs/caveats in the documentation:
http://cocoon.apache.org/2.1/userdocs/core/image-reader.html


Regards


Vik

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by Anish <an...@techblue.co.uk>.
> As far as I know that's not possible without extra tool / code.  Is it ? 

Yes Andre, but I wanted to incorporate that code into my application I 
mean the required modification. I couldn't find the cocoon code block 
which by default sets mime-type to jpeg.


André Davignon wrote:
> Hi,
>
> As far as I know that's not possible without extra tool / code.  Is it ?
>
> André
>
>> Hi All
>>
>> I want to use ImageReader to read jpg images (from file) and then to 
>> serve as gif (or any other format like png, tiff etc). I'm unable to 
>> find solution for that.
>>
>> Please suggest and let me know how I can modify/convert mime-type for 
>> the response.
>>
>>
>>
>> TIA
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


-- 
Anish Sneh
Software Engineer
Techblue Softwares Pvt. Ltd.
www.technologyblueprint.co.uk




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Modifying MIME-TYPE with ImageReader

Posted by André Davignon <an...@free.fr>.
Hi,

As far as I know that's not possible without extra tool / code.  Is it ?

André

> Hi All
>
> I want to use ImageReader to read jpg images (from file) and then to 
> serve as gif (or any other format like png, tiff etc). I'm unable to 
> find solution for that.
>
> Please suggest and let me know how I can modify/convert mime-type for 
> the response.
>
>
>
> TIA
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org