Jump to content

ryanb

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ryanb's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I figured out the problem; it was this bit: [code]$full_dim = getimagesize($full); if ($full_dim == FALSE) {[/code] because I was running the script using dreamhost.com, and a getimagesize() returning FALSE causes the script to stop or something (for security reasons maybe?)  So to fix it, I changed only a couple of lines and worked things around the file_exists() function so that the error-image is created on the basis of file_exists() returning FALSE rather than getimagesize(). Thanks for your help!
  2. Hello, I have a PHP script that cuts-out a portion of a full-sized image and uses it for a thumbnail image on a page.  If the full-sized image doesn't exists, then a generic image is created to take its place.  My problem is that these error images work/show-up on my own machine, but not on my host.  From a phpinfo(), we both have GD 2.0.28 compatiable under PHP 5.1.2 for me and PHP 4.4.2 for them.  I checked and all of the functions used should be supported by the older PHP 4.  The creation of thumbnails when the image can be found works fine on the host, just not the error image.  This is the error image generation part: [code]// Size of full-size image $full = $root . $full . '.png';                                        // The full path of the file (assumes it is PNG) $full = str_replace(' ', '%20', $full);                                // Encode any spaces in the filename correctly $full_dim = getimagesize($full); if ($full_dim == FALSE) {                                              // Check to see if the file exists     $error_img = imagecreatetruecolor($thumb_width, $thumb_height) OR exit('New GD stream failed.');     $background = imagecolorallocate($error_img, 0xbc, 0xd5, 0xe7);    // The full color is #bcd5e7 (a blue), the same as the background of <body>     $text = imagecolorallocate($error_img, 0, 0, 0);     imagefilledrectangle($error_img, 0, 0, $thumb_width, $thumb_height, $background);     imagestring($error_img, 1, 10, 9, 'File not found.', $text);      // Draw error message in image     header('Content-type: image/png');     imagepng($error_img);     imagedestroy($error_img);     exit(0); } else {     //  Stuff for when the file is found [/code] Thank you for your help!
  3. Hello, I have run into a problem updating a site to use extension-less filenames in things like anchors, where the old version says, [font=Courier]<a href="test.php">[/font], but I want the new version to say [font=Courier]<a href="test">[/font] (no extension).  The problem is that there are some directories with the same names as files, like [font=Courier]test/[/font] . I have MultiViews turned-on, so when I use [font=Courier]<a href="test">[/font], I get the directory [font=Courier]test/[/font] instead of the file [font=Courier]test.php[/font] . I am trying to use mod_rewrite to solve this, but the only way I can get close is to use [font=Courier]RewriteRule ^test/$ test.php [R][/font] The problem with that is it shows "test.php" in the URL.  If the "[R]" is not used, the HTML of the page will show-up okay, but links to styles sheets and images don't work because the paged is displayed as if it were one directory level deeper than it is (because/and the URL will show "test/", with the slash). My initial thought, which doesn't work, was [font=Courier]RewriteRule ^test$ test.php[/font] but it seems that MultiViews acts before rewriting because that rule will have no effect and I will get the directory because I guess MultiViews will go for a directory before a file of the same name. Thank you very much!
  4. Do you mean something like [font=Courier]RewriteRule ^(.*)\.html$ $1.php[/font] which will make [font=Courier]anything.php[/font] show-up instead of [font=Courier]anything.html[/font]?  The [font=Courier]$1[/font] will be whatever is found in the parenthesis.  Hope this helps!
  5. [Windows XP, PHP5, Apache 2] Hello, Is there a way so you can have a file and a directory of the same name, both in the same directory, and still use MultiViews and reference files without using extensions? For example, a file [color=green]test.php[/color] and a directory [color=green]test/[/color] are in the same location.  I would like to be able to use something like, [color=green]<a href="test">[/color] to show [color=green]test.php[/color], not [color=green]test/[/color] the directory (which is what it does now).  Is there a way to make Apache look for a file before a directory, or am I just going to have to make them different names?  Thank you very much! Ryan [attachment deleted by admin]
×
×
  • 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.