[PHP] Magic Quotes or Curley Quotes or Something

2005-08-05 Thread Lance Earl
I recently upgraded my server. It is running Ubuntu Linux with PHP and
MySQL. My site allows people to post content to their own web oages
through a web interface. Many of my customers compose their content on a
word processer and then cust and paste it to the web interface for
insertion to the database and later retrevial and display on a web page.

The problem I am having is that content which includes quotes is is not
being seen correctly. Rather than inserting a slashed quote (/), it
inserts a bunch of strange formatted gunk. A sample of the problem anc be
seen at www.dallypost.com/ranch/page5688.php

Thanks


-- 
Lance Earl, President
DallyPost, Inc. - Equine Marketing/Training/Shows
Rockland, Idaho 208-548-2721 or 208-604-2721
[EMAIL PROTECTED]
http://www.dallypost.com  http://www.dallypost.com/ranch
Horse Marketing - Clinics - Shows

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Magic Quotes or Curley Quotes or Something

2005-08-05 Thread Lance Earl
Hi Marco,

Thanks for the help, you gave me a place to start. Before doing what would
amount to a lot of coding to correct this problem throughout my site I
wanted to see if it could be corrected on the server side.

I found the following section in the php.ini file:

; As of 4.0b4, PHP always outputs a character encoding by default in
; the Content-type: header.  To disable sending of the charset, simply
; set it to be empty.
;
; PHP's built-in default is text/html
default_mimetype = text/html
default_charset = utf-8
;default_charset = iso-8859-1

In the default file the iso-8859-1 line was commented out so I uncommented
it to see it that would help. It changed the unreadable goop to another
type of unreadable goop but the problem remained.

I then recommented the iso-8859-1 line and added the utf-8 line. This
changed the output back to what I had before. My thinking is that since my
code worked under the older version of php, it should also work under the
newer version if I can configure it correctly.

Thanks,

Lance

 Hello Lance--

 On 8/5/05 2:18 PM, Lance Earl [EMAIL PROTECTED] wrote:

 I recently upgraded my server. It is running Ubuntu Linux with PHP and
 MySQL. My site allows people to post content to their own web oages
 through a web interface. Many of my customers compose their content on a
 word processer and then cust and paste it to the web interface for
 insertion to the database and later retrevial and display on a web page.

 The problem I am having is that content which includes quotes is is not
 being seen correctly. Rather than inserting a slashed quote (/), it
 inserts a bunch of strange formatted gunk. A sample of the problem anc
 be
 seen at www.dallypost.com/ranch/page5688.php


 You have an encoding problem--the content is being uploaded to your site
 using a different encoding mechanism (most likely utf-8) than the one you
 use to display it.

 I'm not much of an expert in this area, but a couple of suggestions:

 1. You're already outputting UTF-8 code from the looks of it, so a simple

 Header (Content-type: text/html; charset=utf-8);

 Or even adding this to your HTML code in the HEAD:

 META HTTP-EQUIV=content-type CONTENT=text/html; charset=utf-8

 Should do it. Remember to also use htmlentities ($data, null, utf-8); to
 properly encode the entities in your content.

 2. Convert the text over from UTF-8 to ISO-8859-1. I think you can use
 utf8_decode, or you may have to go with the mbstring extension (not too
 sure
 here, I'd just go ahead and convert everything over to UTF-8).

 I'm sure some other people who have more experience with this stuff can
 give
 you even more pointers, but this should get you started.

 Cheers,


 Marco

 --
 BeebleX - The PHP Search Engine
 http://beeblex.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Lance Earl, President
DallyPost, Inc. - Equine Marketing/Training/Shows
Rockland, Idaho 208-548-2721 or 208-604-2721
[EMAIL PROTECTED]
http://www.dallypost.com  http://www.dallypost.com/ranch
Horse Marketing - Clinics - Shows

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] imagecopyresized() problems

2002-07-09 Thread Lance Earl

I am trying to create a piece of code that will create and display
thumbnail image. When trying to send the image to a browser, I see
binary data rather then an image. You can see the problem at
www.dallypost.com/a/test.php

The troubled cose for this page follows:

?PHP

//a master image may be any image of any size

//If the master image exists, the thumb will be created and output to
the browser

//requires path from the file system home directory as
$master_image_path

//requires the name of the master image as $master image


//test variables -- will eventually be defined by the calling module
$master_image_path = /home/html/74ranch/uploads/;
$master_image = chex34.jpg;



if(!isset($thumb_width))
{
$thumb_width = 80;
}//end if


//make sure that the master file exists
$master_image_all = $master_image_path;
$master_image_all .= $master_image;

//remove this section after coding is complete
$master_image_all_link = /74ranch/uploads/;
$master_image_all_link .= $master_image;
print(img src = $master_image_all_link);

if(file_exists($master_image_all))
{
$size = getimagesize($master_image_all);
$width = $size[0];
$height = $size[1];


//calculate thumb height
$factor = $width / $thumb_width;
$thumb_height = $height * $factor;
$thumb_height = $thumb_height * .1;
$thumb_height = round($thumb_height);
print(P Origional: height: $height width:
$widthBRTarget:
height:$thumb_height width: $thumb_widthP);

//build the thumbnail 
$src_img = imagecreatefromjpeg($master_image_all);
$dst_img = imagecreate($thumb_width,$thumb_height);
//$dst_img =
imagecreatetruecolor($thumb_width,$thumb_height);//requires
 gd 2.0
or higher

print(PVariables that will be inserted into the  
imagecopyresized
function);
print(BRwidth: $width);
print(brheight $height);
print(brthumb_width $thumb_width);
print(brthumb_height $thumb_height);

print(PDisplay the new thumb imageP);

imagecopyresized($dst_img, $src_img, 0, 0, 0, 0,
$thumb_width,
$thumb_height, $width, $height);


//imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0,
$thumb_width,
$thumb_height, $width, $height);//requires gd   2.0 or higher


//imagejpeg($dst_img, path and file name, 75);//saves
 the image to
a file

imagejpeg($dst_img, '', 50);//sends the image to thebrowser

imagedestroy($src_img);
imagedestroy($dst_img); 



}//end if
?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php