Jump to content

jrtderonde

Members
  • Posts

    35
  • Joined

  • Last visited

Everything posted by jrtderonde

  1. The module (somehow) stopped working. I installed it and (like always) it worked like a charm. I used the somewhat older version but after restarting my localhost it stopped working. I deleted it, installed the newer version, and even tried to use a different login template. Nothing seems to work. Is this a frequent error that's easy to solve? And might it be in conflict with the MVC-ish Approach I am using? (https://processwire.com/talk/topic/4892-an-almost-mvc-approach-to-using-templates/). I deleted the cache, the sessions and I even set the specific role "superuser" to the page. Yet I can just visit the Home page without having to login. It might be a real rookie/newbie mistake I'm dealing with, would be sweet if anyone knows how to solve it.
  2. Hi all, I am using Processwire to synchronize Albums form a Facebook Page into Processwire. Works like a charm! I'm using two loops to synchronize the albums One loop that creates a page that stands for the "album" One loop that stores every image within the album as a child of the "album" I experienced that this loop however only synchronizes the first 25 images. I was wondering, is there any kind of limitation that comes with the page creation API? I used the following script as posted before by Ryan if I'm not mistaking $p = new Page(); $p->template = "fb_image"; $p->parent = $pages->get("name=$id"); $p->title = $hash; $p->name = $hash; $p->save(); $p->fb_image = $image["images"][0]["source"]; $p->save(); Hope someone has the answer!
  3. Hmm, I think that it will be impossible to retrieve the image as the URL redirects (302) to a different page. I am not able to grab the image URL after trying several methods (php, curl). Has anyone experienced this specific problem before?
  4. I found that the image URL is actually a 302 Redirect. >>> https://www.facebook.com/ads/image/?d=AQKSUWuaIXz-dJmE44rETRVS0tH_wzPCCIb0oJQqB9LKNeLWUSFkJvcHYNCx0pywb4q8k6iaC9RF25kOlvgY7NCzW96myAtYf8u6Ap4gi2_CVdJ-eScWQhmB8dGbAfl1iKiR_CS1gMMxHwWWfo_nLxeZ > -------------------------------------------- > 302 Found > -------------------------------------------- Status: 302 Found Code: 302 Location: https://scontent.xx.fbcdn.net/hads-xfa1/t45.1600-4/12480837_6037580358670_471536793_n.png P3P: CP="Facebook does not have a P3P policy. Learn why here: http://fb.me/p3p" X-Frame-Options: DENY Content-Type: image/png X-Content-Type-Options: nosniff X-XSS-Protection: 0 Strict-Transport-Security: max-age=15552000; preload Public-Key-Pins-Report-Only: max-age=500; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E="; pin-sha256="q4PO2G2cbkZhZ82+JgmRUyGMoAeozA+BSXVXQWB8XWQ="; report-uri="http://reports.fb.com/hpkp/" Pragma: no-cache Expires: Sat, 01 Jan 2000 00:00:00 GMT Cache-Control: private, no-cache, no-store, must-revalidate Access-Control-Allow-Origin: * Set-Cookie: reg_ext_ref=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=.facebook.com; httponly Vary: Accept-Encoding X-FB-Debug: n+c81EJaLrZR8h4YdM/RGKNqGl8MN/vv8rPkQiyKQnA/KPlV1vMuWMwF2TkWiNTDrj/0CdHxzjCSvAA7G1Qpow== Date: Tue, 23 Feb 2016 10:57:37 GMT Connection: close Content-Length: 0
  5. Thanks for your input. Out of 25 images, 23 are stored correctly (those with a valid URL that actually has an extension at the end). Two of these are links that a user is redirected to after the URL is visited. Processwire is able to actually store these images directly from an URL, so that's a plus, I am only facing a problem with these "redirected" urls.
  6. I believe that this is indeed part of the solution, I will check, thanks!
  7. For your information, I tried to "explode" the "safe-url" to an URL in which only the image-url is pointed out. I get the following error; Notice: Undefined index: extension in C:\wamp\www\abelle\wire\core\Sanitizer.php on line 314 I'm starting to get the feeling that Processwire will not really be able to grab this image from the given URL and parse it to the backend. Does anyone know a solution?
  8. Hey, I'm currently working on a script that automates the import of certain Facebook posts. The script basically requests all the Facebook posts (combined with Images). It loops through all the posts and stores these within Processwire. I did this because I experience the Facebook API as very slow. I will run a Cronjob on this "hidden page" that imports the posts every 10-15 minutes. These posts are then loaded directly from Processwire so the API doesn't affect the loading speed of the page. I experience a minor issue that keeps me from importing all posts correctly. Some images (from the Facebook API) are given through some kind of "safe-image url" - like this: https://external.xx.fbcdn.net/safe_image.php?d=xxxxx&url=https://www.facebook.com/ads/image/?d=xxxxx Regular images (in comparison to this one) are given like this: https://scontent.xx.fbcdn.net/hphotos-xtp1/v/t1.0-9/s720x720/xxxxxx.jpg?oh=xxxxxx&oe=xxxxx Processwire has no problems with storing the images with the url as stated above this line. The "safe-images" however are causing some problems as I experience the following error: Error: Exception: Unable to copy: https://external.xx.fbcdn.net/safe_image.php?d=xxxx&url=https://www.facebook.com/ads/image/?d=xxx-xxxxx-xxxxx=> C:/wamp/www/abelle/site/assets/files/1335/d_aqksuwuaixz-djme44retrvs0th_wzpccib0ojqqb9lknelwusfkjvchyncx0pywb4q8k6iac9rf25kolvgy7nczw96myatyf8u6ap4gi2_cvdj-escwqhmb8dgb.com_ads_image__d_aqksuwuaixz_djme44retrvs0th_wzpccib0ojqqb9lknelwusfkjvchyncx0pywb4q8k6iac9rf25kolvgy7nczw96myatyf8u6ap4gi2_cvdj_escwqhmb8dgbafl1ikir_cs1gmmxhwwwfo_nlxez (in C:\wamp\www\abelle\wire\core\Pagefile.php line 117) I'm wondering if anyone has experienced this same problem before. I am using the following little script to store the image within the back-end of my project. foreach ($array["posts"] as $post): // Get the specific id $id = $post["id"]; // See if there is any pages with the ID yet $spider = $pages->find("title=$id"); if ($spider->count() != 1): // Set the counter echo "<li>$i: New record found</li>"; // Set all the information $new = new Page(); $new->template = "news"; $new->parent = $parent; $new->save(); // Parse the variables, check valid if needed $new->title = $post["id"]; $new->post_id = $post["id"]; // Check for these if (!empty($post["message"])): $new->post_message = $post["message"]; endif; // Check for these if (!empty($post["story"])): $new->post_title = $post["story"]; else: $new->post_title = $post["id"]; endif; // Declare the time $new->post_date = date_format($post["created_time"], "d-m-Y H:i:s"); // Check for these if (!empty($post["message"])): $new->post_message = $post["message"]; endif; // Check for these if (!empty($post["full_picture"])): // Grab the url $url = rawurldecode($post["full_picture"]); // Parse it to the backend $new->post_full_picture = $url; echo $url; endif; // Save the page $new->save(); else: // Set the counter echo "<li>$i: Original record found</li>"; endif; // Increment the counter $i++; endforeach;
  9. Hey Adrian, Thank you for your quick reply. It worked like a charm! I indeed tried to move the files directly from the user's end to a folder that corresponded to the page id. Knew I was wrong somewhere. Thanks!
  10. Hi, I'm working on a script that allows users to add a new Page to my installation of ProcessWire. I will explain how this script works below. The user enters some information into a simple form ^ This can include an image The form is validated with jQuery When valid, the form triggers a function through a class that handles the process I will include some of the code below. Form: <form id="entry" class="entry" method="post" action="./" name="entry" enctype="multipart/form-data"> <div class="row"> <input type="text" name="fullName" id="fullName" placeholder="Naam initiatiefhouder *" data-validation="required" /> </div> <div class="row"> <input type="text" name="projectName" id="projectName" placeholder="Projectnaam *" data-validation="required" /> </div> <div class="row"> <input type="email" name="emailAddress" id="emailAddress" placeholder="E-mailadres *" data-validation="required" /> </div> <div class="row"> <textarea name="projectDescription" id="projectDescription" placeholder="Beschrijf uw initiatief *" data-validation="required"></textarea> </div> <div class="row"> <input type="file" id="image" name="image" data-validation="mime size" data-validation-allowing="jpg, jpeg, png, gif" data-validation-max-size="2M" /> </div> <div class="row"> <input type="submit" name="submitEntry" id="submitEntry" value="Insturen" /> </div> </form> So basically the "image" field is the field that allows the user to add a file (jpg, jpeg, png, gif - max 2mb). Now, when all the information is valid it will post this form through the following function. public function pushEntry ($input, $file) { // Unset the array $this->array = []; // If there is any data if ($input) { // Get some of the variables needed $this->name = $this->sanitizer->text($input->fullName); $this->email = $this->sanitizer->email($input->emailAddress); $this->project = $this->sanitizer->text($input->projectName); $this->description = $this->sanitizer->text($input->projectDescription); // Get the date $this->date = date("d-m-Y H:i:s"); // Generate the title $this->title = "$this->project - $this->name"; $this->duplicate = $this->pages->find("title=$this->title"); // Generate the array $this->array = [ "title" => $this->title, "fullName" => $this->name, "emailAddress" => $this->email, "projectName" => $this->project, "projectDescription" => $this->description, "date" => $this->date ]; // Create the page $new = new Page(); $new->template = $this->templates->get("entry"); $new->parent = $this->pages->get("/entries/"); foreach ($this->array as $key => $value) { // Foreach key and value, create a new page $new->$key = $value; } // Check if there is any duplicates if ($this->duplicate->count() == 0) { $new->save(); } else { echo "Dit initiatief bestaat al."; exit; } // If there is an image if (!empty($file["image"]["name"])) { // Some variables $this->path = $this->config->paths->assets . "files/$new->id"; // Set the extensions $this->extensions = [ "jpg", "jpeg", "png", "gif" ]; // Do the Wire $this->image = new WireUpload($file["image"]["name"]); $this->image->setMaxFiles(1); $this->image->setOverwrite(false); $this->image->setDestinationPath($this->path); $this->image->setValidExtensions($this->extensions); // Execute and check for errors $files = $this->image->execute(); // Add the image to the page $this->fileName = $file["image"]["name"]; $this->fullPath = $this->path ."/". $this->fileName; // Move the file $new->image->add($this->fullPath); // Unlink the file unlink($this->fullPath); // Save the page $new->save($new->id); } } // Return the array return $this->array; } The script adds a page to my installation of ProcessWire perfectly; except for the file upload. I encounter the following errors; Warning: unlink(C:/wamp/www/gezondsteregio/site/assets/files/1135/dekkleden_header.1919x301.jpg): No such file or directory in C:\wamp\www\gezondsteregio\site\templates\controllers\home.php on line 106 Warning: filemtime(): stat failed for C:/wamp/www/gezondsteregio/site/assets/files/1135/dekkleden_header.1919x301.jpg in C:\wamp\www\gezondsteregio\wire\core\Pagefile.php on line 324 Warning: filemtime(): stat failed for C:/wamp/www/gezondsteregio/site/assets/files/1135/dekkleden_header.1919x301.jpg in C:\wamp\www\gezondsteregio\wire\core\Pagefile.php on line 324 I am really curious if someone can help me with this problem. I have tried this script on both my localhost (regular Apache) and my webhost (Fast CGI). Regards, Jim Oh, and I use the following script to trigger the function. $entry = new Entry(); // If there is a post if ($input->post->submitEntry && !empty($input->post->fullName) && !empty($input->post->emailAddress) && !empty($input->post->projectName) && !empty($input->post->projectDescription)): // Push the entry to the controller $entry->pushEntry($input->post, $_FILES); endif;
×
×
  • Create New...