Jump to content

Frank Vèssia

  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Frank Vèssia

  1. I didn't try on another server but I have checked file permissions, I also removed the unlink command to see if the file si uploaded and it's there, plus I use this exact code in another part of the site to add pictures to users profile and it works, the only difference is the template, user template vs normal page, it's quite a mistery...
  2. thanks @horst and @lokomotivan but I already tried ->add but nothing changed ? , as I said this code has been used a lot of times in other projects with no issues, I really don't know what's happening here
  3. Hello guys, I'm stuck on a simple images upload, it's not the first time I use a code like this but this time I get no errors and I don't know where is the problem. The page is saved, the log is saved with the image path but it's not added to the page...I checked everything... $page->of(false); $page->title = $nome; $page->city = $city; $page->phone = $phone; if($page->save()){ $file_field = "images"; $file_extensions = array('jpg', 'jpeg'); $max_upload_size = 6*1024*1024; $overwrite = false; $upload_path = $config->paths->assets . "tmp_uploads/"; if(is_dir($upload_path)) { $img = new WireUpload($file_field); $img->setMaxFiles(1); $img->setMaxFileSize($max_upload_size); $img->setOverwrite($overwrite); $img->setDestinationPath($upload_path); $img->setValidExtensions($file_extensions); $files = $img->execute(); if(!$img->getErrors()){ foreach($files as $filename) { $log->save("upload","page id: ". $page->id." ".$upload_path . $filename); $page->$file_field = $upload_path . $filename; unlink($upload_path . $filename); } $page->save(); }else{ // get the errors if(count($img->getErrors()) > 1){ // if multiple error foreach($img->getErrors() as $e) { $results .= $e." "; } } else { // if single error $results = $img->getErrors(); } } }else{ $results = ""; } $page->of(true); }else{ $results = "Error"; }
  4. Hello guys I've been searching for a way to login users without password (after they login with facebook button), I've found some api functions that seem to be working but I still have some issue. What I do is: $checkUser = $users->get("login_facebook_id=$uid"); if($checkUser->id){ $users->setCurrentUser($checkUser); $user = $users->getCurrentUser(); $session->_user_id = $user->id; $session->redirect("/",false); } The code looks working because after setting the session the current $user->id returns the user I found, but after the redirect $user id back to guest (40)...any idea why ? Thanks
  5. I tried starting from something like this with no luck
  6. I really don't know, but my site now is handling millions of requests per day without any problem since the switch...so something is there but I'm no DB expert...and I have a very powerful machine, 32core 256GB RAM, ssd etc...no apache or cpanel or other slow stuff...
  7. I'm having some trouble on trying to change/remove a label before a checkbox, since the text is already displayed on the side it's useless to have again the label on top with the same text...any idea on how to hook the label render? thanks
  8. well, I solved just changing tables from myIsam to InnoDB, now everything is fast even if that table is huge
  9. Any update on this great module? Can't install on PW > 3 I get this error: Cannot declare class ComposerAutoloaderInit700022e1c519b28dbab39fa2456e3e43, because the name is already in use (line 5 of /home/nginx/domains/public/site/assets/cache/FileCompiler/vendor/composer/autoload.php)
  10. Hello, I always enabled the session handler DB on my sites and it worked pretty well, but right now I'm facing a big issue because it's slowing down the server. I have a dedicated server with 32 core and 192MB RAM so it's a good beast but since the traffic on the site is huge the session table is up to millions records each day. I also setup the config like so ini_set('session.gc_probability', 1); ini_set("session.gc_divisor", 100); still the amount of records is impressive and the queries deleting the sessions are constantly executing and they are slow...any idea how to optimize this? thanks
  11. Hello guys, I'm trying to setup a textarea allowing extra content for the tag <A> but it's not working, i just need to be able to add "class" to the tag, so I just added this to the ckeditor input settings, "extra allowed content" a[href,class,rel] but it's ignored...any idea? using PW 3.0.42
  12. Hello, I just copied a website on a new domain on the same VPS as I made hundreds of times, but this time I get this error regarding PDO support Fatal error: Exception: Required PDO class (database) not found - please add PDO support to your PHP. (in /home/public_html/wire/core/ProcessWire.php line 260) #0 /home/public_html/wire/core/ProcessWire.php(118): ProcessWire\ProcessWire->load(Object(ProcessWire\Config)) #1 /home/public_html/index.php(52): ProcessWire\ProcessWire->__construct(Object(ProcessWire\Config)) #2 {main} in /home/public_html/index.php on line 64
  13. Hi, is there a way to throw a 404 if the page number doesn't exist? I have 77 pages but if i type the 78 I can still see the page (empty of course) and i think google is messing up in some way indexing those pages, even if there are no links to them.
  14. Hello, some images on my website get error (too many redirects) but just for the variation version on ssl. so the image /site/assets/files/0/02/07/557/xxx.jpg is ok but /site/assets/files/0/02/07/557/xxx.380x180n.jpg is not displayed I've recently moved my domain on ssl so right now every url redirects to https and almost all images are ok, but some of them get this error.....any idea?
  15. yes, sort=parent was the missing point. thanks
  16. This doesn't group by parent, simply add the parent on top of each dish. I need to render all dishes of a restaurant one time I need to search by dishes but render exactly like I have in the tree.
  17. Hi, it's possible to get the result of a selector grouped by parents? My structure is like this restaurant 1 - dish - dish ... restaurant 2 - dish - dish ... In my search form there is a free text for searching a dish and a location. (location info is inside restaurant) The result of the search should be the list of restaurants offering that particular dish, with the dishes below. Right now I first search all restaurants in that location and after that all dishes (if they have) and display the result by restaurant. This is not the best because I have to search all restaurant I have first. I tried just to search for the dishes with parent in that location but in this way I can display only the dishes list and I need to display the restaurants list with the dishes below.
  18. I solved. The problem was I imported all those pages as children of an admin page. That caused the block. Moving the pages fixed the problem.
  19. Hi guys, I imported some emails and I created a page for each (about 100k pages). After the import I got this error whe I try to login into the admin Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 32 bytes) in /home/public_html/wire/core/PageTraversal.php on line 111 and the tree doesn't show up. Any idea?
  20. the image field holds multiple images, that was my first thought the echo outputs the same filename, there is no variation, that's the problem, it replaces the original image
  21. I'm using pim2 as you can see from the code "->pim2Load". In any case (prefix or suffix) the original image has been replaced. Anything to look in PW, some config options can interferes with the module?
  22. Hi, I don't know if depends of PW devns 3.0.10 or something in my code but this $watermark = $config->paths->root.$config->site_cdn."wm.png"; $options = array('outputFormat'=>'jpg','quality'=>70); // first method $pic->image->first()->pim2Load('wtm')->setOptions($options)->watermarkLogo($watermark,'SE',8)->pimSave(); // another try $pixelateVersion = $pic->image->first()->pim2Load('pxtd',true)->setOptions($options)->width(700)->pixelate(30)->pimSave(); $pic->image->add($pixelateVersion); simply overwrites the first image file without creating a copy with prefix as expected. I copied this code from another pw installation (2.6)
  • Create New...