Jump to content

crwork

Members
  • Posts

    38
  • Joined

  • Last visited

crwork's Achievements

Member

Member (2/5)

1

Reputation

  1. Thanks folks, that sounds like the best solution to me as well.
  2. I'm trying to resize a larger image into a small 24x24 avatar. Via imagecopyresampled, I was able to crop the larger image into a square and resize successfully so that the image wouldn't be distorted when transformed into a small avatar. However, I was told I need to keep the original image aspect ratio as much as possible when fitting into a fixed 24x24 frame. So the avatar frame still needs to be 24x24 but the image that fits inside it, which will most likely be a landscape image, should retain the original aspect ratio as much as possible. This will no doubt result in a letterbox appearance. With regard to the code, can this be done with imagecopyresampled so that the actual image, assuming landscape, doesn't fill up the entire 24x24 window and become distorted? This is my current code that will crop a landscape large image into a square then resize down to 24x24: imagecopyresampled($imNew, $im, 0, 0, $xoffset, 0, 24, 24, $origHeight, $origHeight);
  3. Yes, if the original were 150x200 I'd want 150x150. If I wanted to crop evenly on both the left and right, I guess I'd just need to do some math and change the parms on the imagecopyresampled command?
  4. I'm creating a user avatar image from a user-uploaded photo. The avatar is required to be 24x24. The uploaded photo has typical dimensions in that the width is going to be greater than the height. This code works as far as re-sizing the original to a 24x24 avatar. The problem is that the image is noticeably distorted. What I'd like to be able to do is figure out a way to crop the original image so that both height and width dimensions are the same, then re-size down to a lower image so that the image isn't distorted: $im = imagecreatefromstring($imgDecoded); // Get width and height of original image resource $origWidth = imagesx($im); $origHeight = imagesy($im); // Create new destination image resource for new 24 x 24 image $imNew = imagecreatetruecolor(24, 24); // Re-sample image to smaller size // resource $dst_image , resource $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h ) imagecopyresampled($imNew, $im, 0, 0, 0, 0, 24, 24, $origWidth, $origHeight); imagepng($imNew); imagedestroy($im); imagedestroy($imNew); Could someone point me in the right direction with regard to a good way to crop the original image before it gets resized? Thanks!
  5. Have a project where I'm trying to connect to an LDAP server with a user and password. My issue is that I can connect to the LDAP with ldap_bind (return code in TRUE), but it doesn't care what I use for a password. It will let me in anonymously or with a known LDAP email address. However I can put in a bad password and it still lets me in. One question I have: is it only possible to use a user password on the ldap_bind step? After I do the bind, I'd like to do a search, via ldap_search. But since the bind is ignoring the password, is there another way to authenticate a password on the ldap_search? $ldaprdn='cn=vvv@vvv.com,ou=Service,o=theorg,dc=com'; $ldapbind = ldap_bind($ldap,$ldaprdn); This works even when I put in a bogus password: $ldaprdn='cn=vvv@vvv.com,ou=Service,o=theorg,dc=com'; $ldapbind = ldap_bind($ldap,$ldaprdn, 'testpw'); It returns TRUE. The end result is that if a user is trying to log in on a form that validates against the LDAP, their user id will be checked, but they could put in any password they want and it will let them in. Any suggestions?
  6. Ok, thanks. I guess that leads me to another related question (let me know if I should start a new thread). In this particular Zend application I'm learning, there is an option for the user to log in, but they can still see the site as an anonymous user without logging in. Just by opening the website as an anonymous user, the app is creating cookies for the anonymous user, setting a user id, and inserting this into a database. Through debugging, I've isolated where it's doing the anonymous cookie creation: if (Zend_Auth::getInstance()->hasIdentity()) { . . . } If I put an exit statement as the first part of the if block, the cookies have already been created. So what doesn't make sense is that the user has not logged in, yet "hasIdentity" is coming back as TRUE. Is this normal behavior for Zend? I looked at the storage adapter (in this case Cookies), and it looks to me like the identity should be coming back as FALSE, but this isn't the case. I'm a bit stumped.
  7. I'm new to Zend and am having trouble understanding something specific about how a user is authenticated. I'm reading that the Zend_Auth class is built with a singleton pattern. So this means just one instance of the object for all users, correct? If that is true, then isn't this command non-user specific? Zend_Auth::getInstance()->hasIdentity() What is that command checking for exactly? Identity of the application itself? Or is it user-specific? Since there are no parameters being passed, I'm having trouble making the connection how that would authenticate a specific user.
  8. I'm generally a fan of Dreamweaver, having used it with Coldfusion and now with PHP. I heard Aptana was a good editor as well. I downloaded Aptana Studio 3, and it seems more PHP friendly to me, and I might consider switching to it were it not for one important flaw: I can't find how to compare a local vs. remote file. I use this in Dreamweaver all the time before uploading especially with a shared server. And even though Aptana allows compare of local files, I can't see how to compare a local vs. remote unless you do it in a compare utility outside of Aptana. Anyone use Aptana and know how to accomplish this if it is even possible?
  9. I'm about to adapt some software that uses Zend for purposes of user authentication. On the home page of the existing Zend site, even if you've logged off, closed all browsers, then come back to the home page without logging on, the code still thinks the user has been authenticated. The following statement is true in index.php: if (Zend_Auth::getInstance()->hasIdentity()) {... I've done some research on user authentication via Zend (which I'm new to), but I seem to missing a basic point. When Zend authenticates a user, where is that information going? To the session? Cookies? It feels like a black box to me. I've looked in the Zend code, but it's a serious labyrinth. I can't pinpoint where the user authentication is going.
  10. Thanks Christian, that helps to narrow it down. lighttpd is running on port 80. Given this info, there's something peculiar going on. Now, when I run phpinfo(), log_errors is set to OFF. So in a test file with an intentional php error I used 'ini_set' to turn it on. Lo and behold the php error was written to the error file specified in the lighttpd.conf file which makes sense given the netstat result. This opens up another question for me about what php.ini file is being used since lighttpd is the active web server. In phpinfo() the value for 'Loaded Configuration File' is '(none)'. Is this normal for lighttpd? I did a search on the server for 'p*.ini'. It found the php.ini in the apache2 directory, but then my search timed out. I searched in the /etc folder separately, but to no avail. Does lighttpd have its own version of a php.ini or am I barking up the wrong tree?
  11. Unfortunately, that didn't work, but thanks for the suggestion, MD. Come to find out this server has both lighttpd and Apache(!), so I think there's a configuration conflict somewhere. Once I get my head around that, I'll post here with any updates.
  12. The reason for my post is that I'm already getting a PHP error and it's not being logged to the default error location in lighttpd.conf. In fact, the file pointed to by server.errorlog in lighttpd.conf doesn't exist. That's why I posted-I am confused as to where the default error log is being written to. Any recommendations?
  13. I'm trying to find the default location for the error_log. We're running a lighttpd server with PHP 5.3. If I run phpinfo(), log_errors is ON, but error_log has no value. Does this mean that the error_log location is whatever is defined in the Apache httpd.conf file? Or in our case, lighttpd.conf?
  14. Ok, thanks for the info!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.