-
Posts
70 -
Joined
-
Last visited
Everything posted by Peter Troeger
-
Images are not saved permanently with ajax upload
Peter Troeger replied to Peter Troeger's topic in Module/Plugin Development
I have not been able to solve this properly. I cheated in order to stop losing images. I added a DB update and changed the file "last-edited"-Date in the module file (InputfieldSlider.module). Now everytime a slider is saved, it updates all temp image files to permanent files. Not a very clean way to do it, but it saves me from losing data for now This is what I added: $sql = 'SELECT `pages_id`,`data` FROM field_images WHERE created LIKE "1970-01-01 01:00:10"'; $query = $this->database->prepare($sql); $query->execute(); $rows = $query->fetchAll(PDO::FETCH_CLASS); $query->closeCursor(); foreach($rows as $row) { $path = $_SERVER["DOCUMENT_ROOT"].'/site/assets/files/'.$row->pages_id.'/'.$row->data; touch($path); } $sql = 'UPDATE field_images SET created=modified WHERE created LIKE "1970-01-01 01:00:10"'; $query = $this->database->prepare($sql); $query->execute();- 2 replies
-
- ajax
- image upload
-
(and 1 more)
Tagged with:
-
Images are not saved permanently with ajax upload
Peter Troeger replied to Peter Troeger's topic in Module/Plugin Development
So, I compared this file with /wire/modules/Inputfield/InputfieldCKEditor/plugins/pwimage/plugin.js and couldn't find any discrepancies. So maybe the problem lies within a different file? It seems to call just an iframe, so I'm not sure why it would be different for ckeditor and te module...- 2 replies
-
- ajax
- image upload
-
(and 1 more)
Tagged with:
-
Hi I'm using a lightly modified Version of ProcessSlider on my PW page (3.0.42). But I'm having a problem with the file upload. It's using Ajax File upload to upload images, which is working fine at first, but the images are only uploaded temporarily (creation date 01.01.1970) when an image is uploaded and saved. When pressing the "save"-Button, this does not change. I'm guessing it's due to changes from PW 2 to 3? This is the js that is calling the iframe upload, I think I don't know what to do to amke it save correctly. Anybody who can give me a hint? /** * ProcessWire iFrameImagePicker plugin * * Light verision of InputfieldCKEditor/plugins/pwimage/plugin.js * * @return callback(src, width, height) * */ function loadIframeImagePicker(page_id, callback) { var page_id = page_id;//$("#Inputfield_id").val(); var edit_page_id = page_id; var file = ''; var imgWidth = 0; var imgHeight = 0; var imgDescription = ''; var imgLink = ''; var hidpi = false; var modalUri = config.urls.admin + 'page/image/'; var queryString = '?id=' + page_id + '&edit_page_id=' + edit_page_id + '&modal=1'; if(file.length) queryString += "&file=" + file; if(imgWidth) queryString += "&width=" + imgWidth; if(imgHeight) queryString += "&height=" + imgHeight; queryString += '&hidpi=' + (hidpi ? '1' : '0'); if(imgDescription && imgDescription.length) { queryString += "&description=" + encodeURIComponent(imgDescription); } if(imgLink && imgLink.length) queryString += "&link=" + encodeURIComponent(imgLink); queryString += ("&winwidth=" + ($(window).width() - 30)); // create iframe dialog box var modalSettings = { title: "<i class='fa fa-fw fa-folder-open'></i> " + "Select Image", open: function() { } }; var $iframe = pwModalWindow(modalUri + queryString, modalSettings, 'large'); $iframe.load(function() { // when iframe loads, pull the contents into $i var $i = $iframe.contents(); if($i.find("#selected_image").size() > 0) { // if there is a #selected_image element on the page... var buttons = [ { html: "<i class='fa fa-camera'></i> " + "Insert This Image", click: function() { var $i = $iframe.contents(); var $img = $("#selected_image", $i); $iframe.dialog("disable"); $iframe.setTitle("<i class='fa fa-fw fa-spin fa-spinner'></i> " + "Saving Image"); $img.removeClass("resized"); var width = $img.attr('width'); if(!width) width = $img.width(); var height = $img.attr('height'); if(!height) height = $img.height(); var file = $img.attr('src'); var page_id = $("#page_id", $i).val(); var hidpi = $("#selected_image_hidpi", $i).is(":checked") ? 1 : 0; var rotate = parseInt($("#selected_image_rotate", $i).val()); file = file.substring(file.lastIndexOf('/')+1); var resizeURL = modalUri + 'resize?id=' + page_id + '&file=' + file + '&width=' + width + '&height=' + height + '&hidpi=' + hidpi; if(rotate) resizeURL += '&rotate=' + rotate; if($img.hasClass('flip_horizontal')) resizeURL += '&flip=h'; else if($img.hasClass('flip_vertical')) resizeURL += '&flip=v'; $.get(resizeURL, function(data) { var $div = $("<div></div>").html(data); var src = $div.find('#selected_image').attr('src'); callback(src, width, height); $iframe.dialog("close"); }); } }, { html: "<i class='fa fa-folder-open'></i> " + "Select Another Image", 'class': 'ui-priority-secondary', click: function() { var $i = $iframe.contents(); var page_id = $("#page_id", $i).val(); $iframe.attr('src', modalUri + '?id=' + page_id + '&modal=1'); $iframe.setButtons({}); } }, { html: "<i class='fa fa-times-circle'></i> " + "Cancel", 'class': 'ui-priority-secondary', click: function() { $iframe.dialog("close"); } } ]; $iframe.setButtons(buttons); $iframe.setTitle("<i class='fa fa-fw fa-picture-o'></i> " + $i.find('title').html()); } else { var buttons = []; $("button.pw-modal-button, button[type=submit]:visible", $i).each(function() { var $button = $(this); var button = { html: $button.html(), click: function() { $button.click(); } } buttons.push(button); if(!$button.hasClass('pw-modal-button-visible')) $button.hide(); }); var cancelButton = { html: "<i class='fa fa-times-circle'></i> " + "Cancel", 'class': "ui-priority-secondary", click: function() { $iframe.dialog("close"); } }; buttons.push(cancelButton); $iframe.setButtons(buttons); } }); }
- 2 replies
-
- 1
-
- ajax
- image upload
-
(and 1 more)
Tagged with:
-
Awesome, thank you ver much! It's working now.
-
I'm using lineheight,horizontalrule,dialogadvtab,tabletools,tableresize,colordialog,magicline,showborders,showblocks I'm not sure what you mean with : Field Input tab, "Remove Plugins", delete magicline. I don't really want to delete ist
-
Has anyone ever tried implementing MagicLine into CKEditor on processwire? I have quite afew extra plugins running very well, but I can't seem to get magicline to work. Any help is greatly appreciated, thanks! -Peter
-
don't allow duplicates in db with form builder
Peter Troeger replied to Peter Troeger's topic in General Support
Thank you, here as well -
don't allow duplicates in db with form builder
Peter Troeger replied to Peter Troeger's topic in General Support
Could you explain how I can do that or point me in the right direction? It'd be for a maximum of 500 entries, so it would be ok if it doesn't scale Thanks! Peter -
Hi I'm using form builder pro and saving email-adresses to the databse. I only want people to be able to sign up once. Is there a way to check if an email-adress is already in the database and send an error? Thanks for any help! Peter
-
Fatal Error: cannot redeclare function
Peter Troeger replied to Peter Troeger's topic in General Support
The error disappeared with the namespaces, but now my site doesn't display correctly (no header and footer and no styling etc.). I'll have to take a closer look next week and try again. Thanks for the help for now. I'll report back next week -
Fatal Error: cannot redeclare function
Peter Troeger replied to Peter Troeger's topic in General Support
Hi Sam, thanks for your good thoughts 1) This happend after my upgrade from PW 2.7 to PW 3. I cleared the cache completely. Not sure if I can turn off the cache now. Is there some code i can add? 2) and 4) when I delete stripTags, it just gives me an error that the next function in _functions.inc is redefined. 3) Functions is ony required_once in the init.inc. When I remove it from there I get an error because of undefined functions that can't be called I don't understand why this worked in PW 2.7 but not in PW 3. But it kind of looks like a cache problem. But I deleted all cache files and they are rpopulated when I open the website. -
Hello My last problem after upgrading to PW 3 was just solves and already do I have a new one :/ My site doesn't load corrctly and I get the error Fatal error: Cannot redeclare stripTags() (previously declared in /site/assets/cache/FileCompiler/site/templates/_functions.inc:24) in /site/templates/_functions.inc on line 32 I looks almost like it's loading the functions file twice. Once the one in my template folder and once the one in the cache folder. I tried deleting all folder in cache und deleting wire completely and reuploading it. I still get the same error. Anyone any hints for me? Thanks a lot! Peter
-
Fatal error: 'ModuleJS' not found after Upgrade to PW 3.034
Peter Troeger replied to Peter Troeger's topic in General Support
thank you, that was it! -
Hi After upgrading to PW 3.0.34 from 2.7.2 I get the following eror: Fatal error: Class 'ModuleJS' not found in /wire/modules/Jquery/JqueryFancybox/JqueryFancybox.module on line 3 Anyone any ideas why that might be? Or has someone maybe encountered the same error? Any help is greatly appreciated! Thank! Peter
-
Using child pages as part of parent page
Peter Troeger replied to Peter Troeger's topic in General Support
Thanks kongondo! I think that post is exactly what I need to look at. -
Using child pages as part of parent page
Peter Troeger replied to Peter Troeger's topic in General Support
Hi kongondo, thanks for the tips. 1. I want the content to be displayed in a certain way and am using the template file so I can just render the child pages in the parent page. 2. When I don't allow guests to view the page it is not displayed in my parent page anymore. I tried redirecting the URL via the redirect module, but it ignores it and still displays the page. 3. When doing this, I get an error for too many redirects 4. I didn't know that to search for, that is my problem :/ Any tipps, then I will do some more research. Thanks! Peter -
I think you can just recreate it. Add a new child to admin with the title "Login" and for Process, choose "ProcessLogin" and hen hide it in the setting. See if that works. Never done it myself
-
In the admin area, in the page tree, under "Admin", is there still a child-page called "login"?
-
Hello maybe someone can help me with my problem. I'm creating a parent page where I define things like header information, slider images, introduction-text... The content of this parent page is generated by creating child pages. But each child is not supposed to have it's own page/url. I just want the children to be part of the parent page (which they are already doing). But, I don't want the child pages to be accessible via their own url. And I don't know how to achive this. I have, for example, a parent page called TEAM. I have created the child pages TEAM-MEMBER-1 and TEAM-MEMBER-1. In the front-end page http://url.com/team is rendered fine with the contents from TEAM-MEMBER-1 and TEAM-MEMBER-1. But the pages http://url.com/team/team-member-1 and http://url.com/team/team-member-1 are also accessible, which I don't want. Any one know what to do? I hope I was able to get my point across. Thanks! Peter
-
Language Tabs problem after upgrade to 2.7.2
Peter Troeger replied to Peter Troeger's topic in Multi-Language Support
My Default language was not the first language in my language list. Meaning, under Setup->Languages the list started with the second language, then my default language followed. I changed that order, so my default language is the first language in the list, and now the tabs work correctly again -
Language Tabs problem after upgrade to 2.7.2
Peter Troeger replied to Peter Troeger's topic in Multi-Language Support
anyone else any ideas? Otherwise I'll try setting up the page from sratch and moving the content, see if that changes anything. -
Language Tabs problem after upgrade to 2.7.2
Peter Troeger replied to Peter Troeger's topic in Multi-Language Support
@WillyC: I uninstalled the HelpferFieldLinks Module, but still no change. It's weird because it just doesn't do anything, even when I click the tabs. No error, but also no hiding of content...really weird. -
Language Tabs problem after upgrade to 2.7.2
Peter Troeger replied to Peter Troeger's topic in Multi-Language Support
@Wanze: yeah, tried that already. No errors in my console "unfortunately" @WillyC: I only have the language tabs in the core, Ver.1.1.3 -
Hello is anyone else having trouble with the multi language tabs after upgrading to 2.7.2. (from 2.5)? Mine all show at the same time noe (see attached screenshot). Maybe someone has an idea how I could fix that? Thanks in advance for any help/suggestions!
-
Hi I'm having a strange problem and can't figure out what's going on. On my processwire installation from time to time (very rarely actually, about 1 every 2 motnhs) my htaccess file is overwritten with an almost empty file, only containing: AddHandler x-mapp-php5.4 .php3 .php4 .php .phtml Maybe someone on here has experienced that before? Thanks for any help Peter