php-general Digest 3 Nov 2007 12:43:52 -0000 Issue 5107
Topics (messages 264000 through 264009):
Re: crop an image
264000 by: Chris Bruce
Re: mail and quotes
264001 by: Jim Lucas
Re: Function return
264002 by: Dan
mysql_fetch_array
264003 by: Eduardo Vizcarra
264004 by: Cristian Vrabie
264005 by: Eduardo Vizcarra
264006 by: Richard S. Crawford
264008 by: M. Sokolewicz
Page cannot be displayed error in IE6
264007 by: tanzeem
Re: Generating HTML table from MySQL table based on some criteria
264009 by: Sudheer Satyanarayana
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
What was the solution here? I am trying to crop but am getting a
black bar the same height as the crop at top. For this image I want
to crop 40 pixels off of the top:
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($jpegpath);
imagecopyresampled($image_p, $image, 0, 0, 0, 40, 765, 810, 665, 1000)
imagejpeg($image_p, $destImage, 75);
How do I merely crop x pixels from an image without having black
bars? I have tried the x coordinate too with the same result.
Thanks,
Chris
On Oct 31, 2007, at 8:58 AM, Merlin wrote:
Merlin schrieb:
Hi everybody,
I am still strugling with the crop problem.
It looks like it is not possible with PHP to do an imagecopyresampled
and and imagecopy on the same image.
Here is what I try to do:
1: Resize image to 80px width and correct ratio
2: Crop from that image a 80x60 part
Both work for themselfes, but not together.
Does anybody see the problem?
$outputImg = ImageCreateTrueColor($maxX, $dstY);
imagecopyresampled($outputImg, $inputImg, $posX, $posY,0,0, $picX,
$picY, $srcX, $srcY);
$outputImg = ImageCreateTrueColor(80, 60);
imagecopy($outputImg, $inputImg, 0,0 , 0, 250, $picX, $picY); If
I leave the second imagecreate away, the image will be copied into
the bigger size and is not 80x60.
Thank you for any help.
Merlin
David Christopher Zentgraf schrieb:
Copying half a pixel? I dare say that's where the problem is.
Chrs,
Dav
On 31 Oct 2007, at 19:34, Merlin wrote:
Hi there,
I do have a small problem with the proportions of image copy
The image is originally vertical in 100px width and 141px height.
Now I want to crop it to 80 px width and 60px height. There
should be no black area and the proportions should be OK. That
means that I have to copy only part of the image. In this case
it would be 40.5px from above (141-60 / 2 ) and until 100.5 (40.5
+60).
This would crop the middle part of the image.
Now with imagecoyresampled I can set the starting point of
40.5px, but not the ending point. The image will have a black
bottom.
Here is the code I am using:
imagecopyresampled($outputImg, $inputImg, 0,0, 0 , 40.5, 80, 60,
$srcX, $srcY);
Thank you for any hint. Maybe somebody has a good idea on how to
crop that image.
Best regards,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
got it, sorrry for the confusion. I mixed up the lables.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Stefano Esposito wrote:
Hi all,
when i send a mail using mail(), every quote and double quote in the
subject and in the body of the mail get escaped. Since this is somewhat
ugly, especially in languages which widely uses the single quotes (as
italian does), i am wandering if there is someway to avoid this.
Thanks for any hint,
Stefano
--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f
Sponsor:
In REGALO 'Meravigliosa Creatura' la super hit di GIANNA NANNINI
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=6615&d=2-11
I bet you if you checked, the input going to your mail function call has the
body/data escaped.
Check that magic quotes are not turned on. This would escape all your form data being sent to the
processing script.
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
--- End Message ---
--- Begin Message ---
I know that while you should be doing proper validation on the server side
and everything, you could somewhat diminish the risk of someone building
their own form and just posting. If you were to check the referring site
which made the post then you could be pretty sure someone didn't make their
own form. Although this too is insecure, since all you need is a Firefox
extension, firebug or grease monkey which let you execute JavaScript could
let you change the page however you want while it's live, the refer would be
proper, etc. What I'm really saying is there is NO secure way to validate
client side, none, absolutely none.
Check that the date coming in is a valid date then create a date object with
it, that way even if they somehow do slip past your date validation then the
object just won't be created correctly.
There's lots to validate.
- Dan
""Nathan Nobbe"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
On 11/2/07, Stut <[EMAIL PROTECTED]> wrote:
Dan Shirah wrote:
> That is correct, the due_date field should only accept a valid date
format,
> such as MM/DD/YYYY. To bypass the need for a validation check for this
> field I simply set the text field to disabled and supplied the user
> with
a
> javascript popup calendar that upon selection populates the date in the
> format I want. :)
Client-side limits are not an effective defense against dangerous
inputs. Server-side validation is a must regardless of any client-side
checking that goes on.
this is an excellent point; consider the scenario where someone posts
directly
to your page, bypasing the client side checks. this is a trival
technique;
inspect the form attributes; determine the submission url and the
submission
method. look at the name attributes of inputs on the page; and then build
a
simple
form that posts those inputs to the same url with the same method.
-nathan
--- End Message ---
--- Begin Message ---
I have a WHILE sentence to retrieve all records from a SELECT query in a
database and am using mysql_fetch_array to store them in a matrix, the
sentence is like this:
while($row=mysql_fetch_array($fotos))
{
$fotos_mostrar[] = $row;
}
$fotos contains all records found in a db table, the SELECT statement is
retrieving 2 columns from a table, how do I store all records in a 2
dimention table so I can use it later ?
this WHILE sentence seems to only store the last record only
Regards
--- End Message ---
--- Begin Message ---
this is most peculiar. your code should do exactly what you expect. have
you initialized the $fotos_mostrar array before the while loop?
$fotos_mostrar = array();
Eduardo Vizcarra wrote:
I have a WHILE sentence to retrieve all records from a SELECT query in a
database and am using mysql_fetch_array to store them in a matrix, the
sentence is like this:
while($row=mysql_fetch_array($fotos))
{
$fotos_mostrar[] = $row;
}
$fotos contains all records found in a db table, the SELECT statement is
retrieving 2 columns from a table, how do I store all records in a 2
dimention table so I can use it later ?
this WHILE sentence seems to only store the last record only
Regards
--- End Message ---
--- Begin Message ---
Yes, matrix has been defined just before this WHILE sentence
"Cristian Vrabie" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> this is most peculiar. your code should do exactly what you expect. have
> you initialized the $fotos_mostrar array before the while loop?
> $fotos_mostrar = array();
>
>
> Eduardo Vizcarra wrote:
>> I have a WHILE sentence to retrieve all records from a SELECT query in a
>> database and am using mysql_fetch_array to store them in a matrix, the
>> sentence is like this:
>> while($row=mysql_fetch_array($fotos))
>> {
>> $fotos_mostrar[] = $row;
>> }
>>
>> $fotos contains all records found in a db table, the SELECT statement is
>> retrieving 2 columns from a table, how do I store all records in a 2
>> dimention table so I can use it later ?
>>
>> this WHILE sentence seems to only store the last record only
>>
>> Regards
>>
--- End Message ---
--- Begin Message ---
On Friday 02 November 2007 18:23:03 Eduardo Vizcarra wrote:
> while($row=mysql_fetch_array($fotos))
> {
> $fotos_mostrar[] = $row;
> }
>
> $fotos contains all records found in a db table, the SELECT statement is
> retrieving 2 columns from a table, how do I store all records in a 2
> dimention table so I can use it later ?
>
> this WHILE sentence seems to only store the last record only
That is peculiar; assuming that your query is properly executed and the code
you're using to display the contents of $fotos_mostrar is written properly.
Can you show us that code?
--
Richard S. Crawford
Editor-in-chief, Daikaijuzine (http://www.daikaijuzine.com)
Personal website: http://www.mossroot.com
Support me in the 2007 Write-a-thon:
http://www.firstgiving.com/richardscrawford
--- End Message ---
--- Begin Message ---
Eduardo Vizcarra wrote:
I have a WHILE sentence to retrieve all records from a SELECT query in a
database and am using mysql_fetch_array to store them in a matrix, the
sentence is like this:
while($row=mysql_fetch_array($fotos))
{
$fotos_mostrar[] = $row;
}
$fotos contains all records found in a db table, the SELECT statement is
retrieving 2 columns from a table, how do I store all records in a 2
dimention table so I can use it later ?
this WHILE sentence seems to only store the last record only
Regards
Are you sure your query is returning > 1 row ? Because from the looks of
the code you posted it should do exactly what you expect it to.
--- End Message ---
--- Begin Message ---
i have 3 php files pag1.php,page2.php,page3.php
I posted to page2.php from page1.php
Then again posted from page2.php to page3.php
But when i click th back button from page3.php in IE 6.0 it displays
a page cannot be displayed error.
When i tried the same with Firefox it displayed the page2.php correctly.
Can anyone suggest a solution to thsi problem
--
View this message in context:
http://www.nabble.com/Page-cannot-be-displayed-error-in-IE6-tf4742094.html#a13560580
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
Wolf wrote:
Sudheer,
Post the code you are using and we'll better be able to point you in the right
direction to get your code working.
Thanks Jim Lucas, Wolf and Jay Blanchard for your suggestions. Here is
the code I am using
[code]
print '<table border="1"><tr>';
$result = mysql_query("SELECT * FROM users where status=1 AND picture <>
'' ORDER BY created DESC limit 20");
while ($user_info = mysql_fetch_object($result)) {
$output .= '<td><center><a href="/user/'.$user_info->uid.'">
<img src="http://example.com/'.$user_info->picture.'" height="90"
></a>
<br />' .'<a href="/user/'.$user_info->uid.'">'. $user_info->name
.'</a></center></td>';
}
print $output;
print '</table>';
[/code]
The above code prints the pictures of last twenty users who have
uploaded their pictures. Each picture is printed in an HTML table cell.
The table has only one row.
I want to split the HTML table into 4 rows each containing 5 cells. Each
table cell should contain one user picture. How can I do this?
PS: The DB column names are slightly different than I mentioned in my
previous message.
Wolf
---- Sudheer Satyanarayana <[EMAIL PROTECTED]> wrote:
Hello,
I have a MySQL table with four columns - userid, created_date, username
and path_to_picture. path_to_picture column contains the path to the
image files of those users who have uploaded pictures. An example path
stored in path_to_picture column is picture/username.png. There are
some users that don't have their pictures uploaded. The column contains
nothing for these usernames.
I want to generate an HTML table with 20 recent users who have uploaded
their pictures. Each row in the HTML table should contain 5 columns.
Thus the HTML table would contain 4 rows.
How can I accomplish this?
I hope I have provided enough information to describe my problem. I
would be glad to provide more details if required.
I tried few permutations and combinations with ORDER BY and LIMIT
clauses to no avail. I have been scratching my head from few hours to
get this to work. Any help would be greatly appreciated.
--
With Warm Regards,
Sudheer. S
http://www.binaryvibes.co.in
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
With Warm Regards,
Sudheer. S
http://www.binaryvibes.co.in
--- End Message ---