Re: Display Dynamic Images in Cake??

2007-11-27 Thread Wayne Fay

Did you set the headers correctly (content type etc)?
Do you have a space (or more than one) appearing at the beginning of
your image file which would cause these problems?

What PHP barcode generation library are you using?

Wayne

On 11/27/07, jonathan [EMAIL PROTECTED] wrote:

 Hi All,

 This seems to have come up a number of times before, but I have not
 found a definitive answer.  I am trying to generate a dynamic image
 (in this case, a barcode from a PHP barcode generation library).  I
 have tried every combination of headers, views, layouts, etc. and
 still all I get is the raw image string (in view source) and not the
 image properly rendered.  Even when I try to save the image to the
 filesystem, it is blank.  I know the library works, because I paste
 almost identical code outside of Cake and all is perfect.

 Does anyone have a definitive way to display image data in Cake?
 (Version 1.1x please ;)

 Thanks much,
 Jonathan
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Display Dynamic Images in Cake??

2007-11-27 Thread jonathan

Hey Wayne,

The image is a PNG so I am using the content-type MIME for PNG.

I do not know how any spaces could work their way in there.  The same
code works outside Cake.

It's called rDataMatrix and relies on the bundled GD Library.

Again, outside Cake, nothing but joy.  Inside Cake, one of my few
moments of misery.  There must be something with the framework that is
altering the image information, or I need to do one more step to keep
the image in the proper format?  Even when I store to a file, the
image is corrupted.


On Nov 27, 2:42 am, Wayne Fay [EMAIL PROTECTED] wrote:
 Did you set the headers correctly (content type etc)?
 Do you have a space (or more than one) appearing at the beginning of
 your image file which would cause these problems?

 What PHP barcode generation library are you using?

 Wayne

 On 11/27/07, jonathan [EMAIL PROTECTED] wrote:





  Hi All,

  This seems to have come up a number of times before, but I have not
  found a definitive answer.  I am trying to generate a dynamic image
  (in this case, a barcode from a PHP barcode generation library).  I
  have tried every combination of headers, views, layouts, etc. and
  still all I get is the raw image string (in view source) and not the
  image properly rendered.  Even when I try to save the image to the
  filesystem, it is blank.  I know the library works, because I paste
  almost identical code outside of Cake and all is perfect.

  Does anyone have a definitive way to display image data in Cake?
  (Version 1.1x please ;)

  Thanks much,
  Jonathan- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Display Dynamic Images in Cake??

2007-11-27 Thread jonathan

Just so you know what the code looks like (nothing fancy at all), here
is the action within my Orders controller. By commenting out the
setFilePath it should output to the browser:

function storeBarcode($oid) {
$this-layout=NULL;
$this-autoRender = false;
$bc = new DataMatrix();
$bc-setBGColor(WHITE);
$bc-setBarColor(BLACK);
$bc-setEncoding(AUTO);
$bc-setFormat(8x18);
$bc-setQuiteZone(10);
$bc-setModuleSize(4);
//$bc-setFilePath('img/barcodes/');
$bc-paint($oid);
}

Here is a link to a working app outside Cake:
http://www.intraviewvs.net/barcode/show_barcode.php?code=12345678

Here is a link to the Cake install (use FF to view source):
https://www.intraviewvs.net/apps/orders/storeBarcode/12345678

The code in each case is identical, aside from the Cake-isms (turning
off render and layout).

Any insight at all would be stellar at this point...


On Nov 27, 3:01 am, jonathan [EMAIL PROTECTED] wrote:
 Hey Wayne,

 The image is a PNG so I am using the content-type MIME for PNG.

 I do not know how any spaces could work their way in there.  The same
 code works outside Cake.

 It's called rDataMatrix and relies on the bundled GD Library.

 Again, outside Cake, nothing but joy.  Inside Cake, one of my few
 moments of misery.  There must be something with the framework that is
 altering the image information, or I need to do one more step to keep
 the image in the proper format?  Even when I store to a file, the
 image is corrupted.

 On Nov 27, 2:42 am, Wayne Fay [EMAIL PROTECTED] wrote:



  Did you set the headers correctly (content type etc)?
  Do you have a space (or more than one) appearing at the beginning of
  your image file which would cause these problems?

  What PHP barcode generation library are you using?

  Wayne

  On 11/27/07, jonathan [EMAIL PROTECTED] wrote:

   Hi All,

   This seems to have come up a number of times before, but I have not
   found a definitive answer.  I am trying to generate a dynamic image
   (in this case, a barcode from a PHP barcode generation library).  I
   have tried every combination of headers, views, layouts, etc. and
   still all I get is the raw image string (in view source) and not the
   image properly rendered.  Even when I try to save the image to the
   filesystem, it is blank.  I know the library works, because I paste
   almost identical code outside of Cake and all is perfect.

   Does anyone have a definitive way to display image data in Cake?
   (Version 1.1x please ;)

   Thanks much,
   Jonathan- Hide quoted text -

  - Show quoted text -- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Display Dynamic Images in Cake??

2007-11-27 Thread jonathan

OK, now I am just talking to myself, but I have had some stellar
insight for anyone following along.  The problem is apparently not in
the display of the image, but in the generation of the image.  I
remember having some issues with global variables in the framework
from time to time, and I think that's the culprit here.  I will post
the final findings for any interested parties...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Display Dynamic Images in Cake??

2007-11-27 Thread Grant Cox

Looks like you are messing with it now - there is an obvious print_r
and br/ before the file data now.

Are you calling exit() after the file data is output, or otherwise
ensuring that cake doesn't attempt to render a view?


On Nov 27, 7:09 pm, jonathan [EMAIL PROTECTED] wrote:
 Just so you know what the code looks like (nothing fancy at all), here
 is the action within my Orders controller. By commenting out the
 setFilePath it should output to the browser:

 function storeBarcode($oid) {
 $this-layout=NULL;
 $this-autoRender = false;
 $bc = new DataMatrix();
 $bc-setBGColor(WHITE);
 $bc-setBarColor(BLACK);
 $bc-setEncoding(AUTO);
 $bc-setFormat(8x18);
 $bc-setQuiteZone(10);
 $bc-setModuleSize(4);
 //$bc-setFilePath('img/barcodes/');
 $bc-paint($oid);

 }

 Here is a link to a working app outside 
 Cake:http://www.intraviewvs.net/barcode/show_barcode.php?code=12345678

 Here is a link to the Cake install (use FF to view 
 source):https://www.intraviewvs.net/apps/orders/storeBarcode/12345678

 The code in each case is identical, aside from the Cake-isms (turning
 off render and layout).

 Any insight at all would be stellar at this point...

 On Nov 27, 3:01 am, jonathan [EMAIL PROTECTED] wrote:

  Hey Wayne,

  The image is a PNG so I am using the content-type MIME for PNG.

  I do not know how any spaces could work their way in there.  The same
  code works outside Cake.

  It's called rDataMatrix and relies on the bundled GD Library.

  Again, outside Cake, nothing but joy.  Inside Cake, one of my few
  moments of misery.  There must be something with the framework that is
  altering the image information, or I need to do one more step to keep
  the image in the proper format?  Even when I store to a file, the
  image is corrupted.

  On Nov 27, 2:42 am, Wayne Fay [EMAIL PROTECTED] wrote:

   Did you set the headers correctly (content type etc)?
   Do you have a space (or more than one) appearing at the beginning of
   your image file which would cause these problems?

   What PHP barcode generation library are you using?

   Wayne

   On 11/27/07, jonathan [EMAIL PROTECTED] wrote:

Hi All,

This seems to have come up a number of times before, but I have not
found a definitive answer.  I am trying to generate a dynamic image
(in this case, a barcode from a PHP barcode generation library).  I
have tried every combination of headers, views, layouts, etc. and
still all I get is the raw image string (in view source) and not the
image properly rendered.  Even when I try to save the image to the
filesystem, it is blank.  I know the library works, because I paste
almost identical code outside of Cake and all is perfect.

Does anyone have a definitive way to display image data in Cake?
(Version 1.1x please ;)

Thanks much,
Jonathan- Hide quoted text -

   - Show quoted text -- Hide quoted text -

  - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Display Dynamic Images in Cake??

2007-11-27 Thread jonathan

Indeed the problem was globals not being seen globally.  I added some
global statements and joy is mine again.

On Nov 27, 3:27 am, jonathan [EMAIL PROTECTED] wrote:
 OK, now I am just talking to myself, but I have had some stellar
 insight for anyone following along.  The problem is apparently not in
 the display of the image, but in the generation of the image.  I
 remember having some issues with global variables in the framework
 from time to time, and I think that's the culprit here.  I will post
 the final findings for any interested parties...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Display Dynamic Images in Cake??

2007-11-27 Thread Baz
Do explain, I'm curious.

On Nov 27, 2007 3:34 AM, jonathan [EMAIL PROTECTED] wrote:


 Indeed the problem was globals not being seen globally.  I added some
 global statements and joy is mine again.

 On Nov 27, 3:27 am, jonathan [EMAIL PROTECTED] wrote:
  OK, now I am just talking to myself, but I have had some stellar
  insight for anyone following along.  The problem is apparently not in
  the display of the image, but in the generation of the image.  I
  remember having some issues with global variables in the framework
  from time to time, and I think that's the culprit here.  I will post
  the final findings for any interested parties...
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---