Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8311857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:56:59+00:00 2026-06-08T19:56:59+00:00

EDIT: Problem solved: Stupid little twit that I am, I had neglected to give

  • 0

EDIT: Problem solved:
Stupid little twit that I am, I had neglected to give the file a name. $testSiteDir was a path with no filename. How can a file be saved without a name! D’Oh!
sorry 😉


I know there’s lots of similar questions around and I’ve been reading through them but since I’ve sort of had to build a hybrid of all the tutorials and articles I’ve got some code which I hoped would work but doesn’t.

I did at one point manage to create copies of the images into the folder I wanted using the copy() function to move it, which worked. But since I want to resize it I need to use GD (as far as I can tell)

here’s my code:

if (is_dir($BooksDir)) {
if ($dh = opendir($BooksDir)) {
    while (($folder = readdir($dh)) !== false) {
        $count++;
        $exclude = array('.','..','etc.');
        if (!in_array($folder, $exclude)){
            echo '<div ' . ($count&1 ? 'class="oddrow"' : 'class="evenrow"') . '>';
            echo $folder . "<br/>" . $count;
            $subDir = $BooksDir . '/' . $folder;
            $filesnfolders = scandir($subDir);
            foreach ($filesnfolders as $file) {
                $ext = pathinfo($file, PATHINFO_EXTENSION);
                if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'gif') {
                    if ($ext == 'jpg' || $ext == 'jpeg') {
                        $origimg = imagecreatefromjpeg($subDir. '/' . $file);
                        $thHeight = 100;
                        $thWidth = 100;
                        $mainWidth = imagesx( $origimg );
                        $mainHeight = imagesy( $origimg );
                        $myThumbnail = imagecreatetruecolor($thWidth, $thHeight);
                        imagecopyresampled( $myThumbnail, $origimg, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $mainWidth, $mainHeight );
                        imagejpeg( $myThumbnail, $testSiteDir );
                    }
                }
            }
            echo '</div>';
        }
    }
    closedir($dh);
}

}

When I try using the above I get the error that I don’t have permission to write to that folder: Unable to open ‘C:/xampp/htdocs/test’ for writing: Permission denied in…

I’ve got three text books and read a bunch of articles about images and php, I haven’t seen anywhere where it tells me what to do

what’s going wrong 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:57:01+00:00Added an answer on June 8, 2026 at 7:57 pm

    Setting write permissions on Windows can be less than obvious.

    Try these instructions http://drupal.org/node/202491 and see how you get on.

    If you use Xampp as a PHP installation, it usually seems to propagate write permissions through the whole directory structure of htdocs. Very handy. Not sure why it hasn’t done it for you.

    EDIT: just noticed that the Drupal page relates to IIS. Maybe this will be better…
    Apache on windows server can't write to file

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: Problem solved. It was my reading that was incorrect, not the SQL :p
[EDIT: Problem solved. Please see my answer below.] In my app I call the
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
edit: Solved - mod_rewrite was the problem I can't get CI to work as
EDIT: Problem solved... and unrelated to the phrasing of the question... sorry for the
EDIT: Problem solved. This was (yet another) situation where the problem wasn't really where
[EDIT]Problem solved, I found the leak. Thank you very much. I'm running a scheduling
EDIT: Problem solved by using $i+1 in function call. I have trouble using variables
EDIT: Problem Solved! For others, To fix it, simply right click the WebView, click
EDIT: PROBLEM SOLVED. It was the FitVids code causing the JWP to not display.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.