-
Posts
4,077 -
Joined
-
Last visited
-
Days Won
87
Everything posted by horst
-
try to wrap curly-braces { } around the width and height properties: width='{$image->width(15)->width}' If this doesn't work you may also interrupt your string and concatenate parts together like: "<img width='" . $image->width(150)->width . "' height...>" ------ As a sidenote: I also see that you use <img ...></img> tags, but I think that this isn't valid HTML. I only know <img src='' width='' ... /> this sort of images tags.
-
delete orphaned files/images from site/assets/files
horst replied to interrobang's topic in General Support
Hi NikNak, I don't use images in tinyMCE textarea fields and I do not know how one can embedd them. But I know that this script deletes all images that are not belong to an page-images-field. I have read about to select images from the current page and from other pages in PW within the tinyMCE. This images belong to page-images-fields and don't get deleted. But if you can upload and embedd images only with the tinyMCE and these images resides under /site/assets/files/nnnn/ folders, I guess they are not known by pw and get deleted. To clarify: where do the images reside you are talking about and how did they get there? (sorry if I ask complicated, but I never used images with tinyMCE) -
If you use a image with width(150) you also have to call for that variation width and height: $changed_content = str_replace("<img ", "<img width='$image->width(150)->width' height='$image->width(150)->height' ", $changed_content);
-
special background-color / background-transparency for collapsed fields?
-
Hi yckart, I guess you are using the basic siteprofile that comes with PW per default. Following is the code of the home-template file. It is located under /site/templates/ and is named home.php. I have added a check for the url segment and the code you need to output a user page, whereas the original code of the home-template completly goes into the else-part: <?php /** * Home template * */ // first lets check if we have a urlSegment1 if( ! empty($input->urlSegment1) ) { // we have a url segment and want to get the page for it // we use ->get() for this, because get returns a single page, whereas ->find() returns an array of pages // but as we use the unique name of the users pages, there only can exist one page with that name $userpage = $pages->get("/users/{$input->urlSegment1}/"); // lets check if we have got a valid page // if PW hasn't found a page, it returns a nullPage and that has always a id 0 if($userpage->id == 0) { // we have no valid page, lets throw a 404 exception throw new Wire404Exception(); } else { // we have a valid page, so lets output the complete users page echo $userpage->render(); } } else { // if there is no url segment, output the homepage include("./head.inc"); echo $page->body; include("./foot.inc"); } This template will work if you use links like "/userpagename/" userpagename is the content of the namefield of your user page. If you have a page /users/foo-bar/, you can call it /foo-bar/ and it will be rendered, if you use /fooBaz/ you will be redirected to a 404 page, and if you call / you go to the homepage. But you also can access the user pages with there native urls: /users/foo-bar/. Hope that helps.
-
Hi yckart, welcome to the forums. One approach could be using urlSegments: Depending on what template/page you are using under /ca/, you may enable "Allow URL-Segments" under Templates -> YOURcaTemplate -> URLs. - with your users pages you define urls like http://localhost/projects/ca/foo/ instead of http://localhost/projects/ca/users/foo/ - on the /ca/ page you first do a check if there is a URL-Segment ($input->urlSegment1) populated and switch to processing with /users/foo/ - if there is no $input->urlSegment1 process the request like you do it yet with /ca/
-
EDIT: is OBSOLETE because could be done by Module http://processwire.com/talk/topic/4758-release-pagetree-add-new-childs-reverse/ ----------------------------------------------------------------------------------------------- When a site display an overview of the latest posts, news, images, etc. the newest entries should be on top of the list. We can achieve that by using an automated setting for the sortfield e.g. when the page was created = "-created". This way we are not able to manually move a single page in the tree. But there are needs for people to do that and it is asked for this multiple times here in the forums. E.g. if you display image thumbs and the last five entries don't harmonize well together, you want to move 1-3 pages down or up - but in generally you are very happy with the sortorder -created. Using a workaround like creating a sticky field and check that is very ugly IMO. It isn't reflected in the AdminPageTree and therefor not very intuitive and not very straight forward. While I have found a solution to achieve this "-sort" with importing pages via API, it would be nice to also have it with manually created pages. Viewing the source the situation seems to be that there is a real chance to allow it: sort must be enabled for using reverse sorting direction (sort and -sort) the sort field in Mysql-DB is of type signed integer, maybe negative values could be allowed to achieve that or maybe the startvalue could be between 0 and max?
-
Lots of images to resize -> timeout in frontend...
horst replied to titanium's topic in General Support
?? Yes, if the first call in a page (template) to display all images by a smaller size than the original sizes, all smaller images must be created first. And if you have e.g. 50 images and every image to resize take 1 second you will run into a timeout after 30 seconds per default. If you want to avoid that you can use the set_time_limit($n) in the loop like I have explained in previous post. Thats one approach to not run into a script-timeout. Once the images are created the complete script will run within a second or less. But there is no drawback to use set_time_limit($n)! Soma has shown another approach, to hook into ajax-upload and do all resizes then. This way all images are allready created / cached before a page is called first time. But if you once change the dimension for the output, you have the same situation as described in the first post: all images are uploaded fine but you have to create 50+ images on the fly. (I suggest to use set_time_limit($n) in the foreach loop ) To limit max-dimensions in field-settings may be a solution in some cases, but not if you e.g. need 300px and 3000px in a site. I'm very interested in a way to do a automated scan for all needed sizes. Here are some lines of code that may be in templates and call images. (to simplify it and to focus on the most common usage, I disregard image-calls from / to other pages / templates): $imgs = $page->images; foreach($imgs as $img) { $img = $img->width < $img->height ? $img->height(600) : $img->width(600); echo "<img src='$img->url' style='width:33%;height:auto' alt='$img->description' />"; } // ... $options = array( 'upscaling' => false, 'cropping' => false, 'sharpening' => 'medium', 'quality' => 84, ); foreach($page->images as $image) { echo "\t<li><a href='{$image->size(800,800,$options)->url}'><img src='$image->width(200)->url' width='$image->width' height='$image->height' alt='$image->description' /></a></li>\n"; } // ... $imgs = $page->images; $options = array('quality'=>75,'sharpening'=>'soft','upscaling'=>true,'cropping'=>true); foreach($imgs as $img) { $options = $img->width < $img->height ? array_merge($options,array('cropping'=>'north')) : $options; // people portraits or landscape ? $img = $img->width(600,$options); echo "<img src='$img->url' style='width:33%;height:auto' alt='$img->description' />"; } And once again - if you have successfully scanned and collected all wanted sizes, this only would work if you never change the dimensions in template after the first images are uploaded to the site. Also I think this is very close to what soma allready has posted and what the OP uses with success. He only has to input the sizes manually into the module. And I think you allready guess what's my suggestion when you want to play save? Yes: call set_time_limit($n) in the loop! -
Lots of images to resize -> timeout in frontend...
horst replied to titanium's topic in General Support
@phil_s: set_time_limit($n) sets the maximum amount of seconds the script may run before it get interrupted! If you set it to zero set_time_limit(0) it may run forever if your server isn't setup to avoid this. But you also don't want to have a script to run forever, because you loose control over it. Therefor it is a good choice to use it with a little amount of seconds in a loop, because it sets the max amount to live with each call again. For example, if the default php server setup for timeout is set to 30 seconds and you have 50 images to process whereas each image will take 2 seconds, your script will crash after the 15th image. BUT, if you call set_time_limit(15) within the foreach loop, all 50 images get processed and the script will run for 100 seconds, - if everything is ok. If the script run into problems with a single image and hangs, it get interuppted 15 seconds after it started to process the damaged image. Conclusion: with this approach you can exceed the default setting a script may run without loosing control. -
unfortunately no improvement on Win7 with FF 24. ------ And I have found at Line 147 of futura-main.css that there is missing the Arimo fontname: /*.ui-widget { font-family: Arial,Helvetica,sans-serif; font-size: 1.1em; }*/ /*.ui-widget .ui-widget { font-size: 1em; }*/ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Arimo,Arial,Helvetica,sans-serif; /* added Arimo as first choice */ font-size: 1em; }
-
Diogo thank's for explaning. I never have heard of that. - But the "a" is one of the points why I like Muli. ?! But also you are right, with Muli the chance to read it as a "o" is much greater than with Arimo. And at least I have the choice to modify the css-file for my personal use.
-
with the colors=futura I find it a bit difficult to identify the hidden pages. With the setting of opacity from 0.75 to 0.5 it is much better: .content .PageList .PageListStatusHidden:not(.PageListItemOpen) > a.PageListPage { opacity: 0.5; } /* original: 0.75 */ Have I allready said that I like the new admin theme?
-
Oh WOW! massive and high improvements and discussion here! I like the results! I want contribute a screenshot to the fonts discussion about Arimo with 0.875em on WIndows 7 etc. AND I want to promote the font Muli instead of Arimo, because allready at this stage the new admintheme is so modern that it suits better with modern font like Muli than with Arimo IMO. Also it seems to be little bit better rendered at 0.875em than Arimo (best click on imgae to view it at 100%):
-
when I switch in images field from listview to the thumbs view and drag to reorder them, they open a modal window with big sized image after dropping. I would like to disable that. e.g. when in thumb view modal opening is disabled or only available via doubleclick! would be good solutions. Or is this behave only with my firefox 24 ?
-
No problem! But when I want to be picky, your question was how to reach the last post. That's with the date-link. The dot or star that soma suggested is linked to the first unread post, not the last one. Also the dot-link is gone when read the whole thread, the date-link stays forever!
-
Ok, I have good working solution I think: set the tree-parent-page sort-setting to "Manual drag-n-drop" when it is empty. (empty == has no children now!) Then with the importer script I use this code: $parent = wire('pages')->get('template=TreeParent'); // get your tree-parent-page $first = $parent->child; // get the first child $p = new Page(); ... $p->sort = (0!=$first->id) ? $first->sort -1 : 99999; $p->save(); that way I get this output with my foreach loop: 99991 :: jh2142 99992 :: jh2141 99993 :: jh2140 99994 :: jh2139 99995 :: jh2138 99996 :: jh2137 99997 :: jh2136 99998 :: jh2135 99999 :: jh2134 and after some manual changes (2134 to top, and 2142 to bottom, and 2135 above 2140) and adding one new page to it with the importer script, I get this: 99990 :: jh2143 99991 :: jh2134 99992 :: jh2141 99993 :: jh2135 99994 :: jh2140 99995 :: jh2139 99996 :: jh2138 99997 :: jh2137 99998 :: jh2136 99999 :: jh2142 You only need to set the startvalue high enough, I think. [ max can be 2.147.483.647 ]
-
@adrian: before it does not work, e.g if the sort-settings is none or manual There was a entry in my DB table pages_sortfields for the treeparent-page that get not altered when changing the template setting ?? After I have deleted this row (the only one in that table) this page reflects the selected template sortsetting again. I want to add multiple pages with an importer script. Somas script works with one single page for me, but not with multiple pages. When I try to add 7 pages and after I'm finished I output $p->sort and $p>customId in a foreach loop, I get this: 0 :: jh2140 1 :: jh2134 1 :: jh2135 1 :: jh2136 1 :: jh2137 1 :: jh2138 1 :: jh2139 I have sort setting 'Manual drag-n-drop'. I have dev branch from last friday.
-
@sshaw: what you are describing is what I have called proxy-script in my opening post. I don't want that for frontend output, because it is not needed and I want avoid overhead. All images that should have public access can be accessed directly. Others (the originals) are blocked to the public. Thats fine. The only downside is that an admin in backend also cannot access the originals. What I'm looking for is how I can define this in htaccess file: all images that are now blocked for direct access should be not served but handled by a proxy script.
-
please, when in desktop mode, hover your mouse over the dates (e.g.Yesterday, 09:17 PM) under the authornames of the last post, wait a second and you will read 'go to last post' - then ... click
-
the base-sorting could be something like -dateCreated but I also want to be able to break that rule and drag some pages manually around. therefor somas solution to emulate -dateCreated like it works with childrens-sortorder set to none would be perfect!
-
thanks Adrian! this solution from soma works partially: http://processwire.com/talk/topic/1428-create-new-child-as-top-sibling-rather-than-bottom/#entry12845 1) It does the right sorting if parent sorting is set to none in template. But than I cannot do manually sort by dragging. I get an JS-Message:"Your sort was not saved because these pages are automatically sorted by ..." BUT that's wrong! It was set to this before I have changed the sort to none. Don't know where the error comes from. I have searched a mysql dump of whole DB, but there isn't a sort-setting in the DB for my parent-folder-template! Could this be a bug? From where is the JS-Message generated? ----- 2) When setting the parent template child-sorting to 'Manual drag-n-drop' I can do a manually sorting, but Somas script doesn't work right anymore!
-
Hi, I'm sure the answer is here to find in forum, but after searching for a while now, I gave up and want to ask for it. How can I add / sort new (via API) created childpages to the top of the parent-tree? I want to have a descending sort order in the backend.
-
http://www.php.net/manual/en/language.operators.comparison.php
-
Is there something new to this, since this thread is over a year old? @Nico: if you have done it, - how have you done it? In the backend I want to have pagetree children sorted by a archive number descending, but also want to be able to manually drag some pages to the top of the tree. All new childpages will be created via API bootsstrapped script. If it is possible with API to add each of them to the top of the page tree, this would allready solve my needs. Any pointers for that?
-
Uah, - ugly! The thumbs are a bit small, but as I can see everyone has: one black pix at the top left a black line at the left and (not totally sure) some black dots around the people Could it be that there wasn't a 100% transparency at this images parts?