mmm...that's good, even It's not what I expected to do. I'm really bad in htaccess...there a way to make this thing more complex? I mean, right now the result it's
http://www.domain.com/pageid/imagefile.jpg
I would like something like
http://cdn.domain.com/pageid/imagefile.jpg
In this way if I want to activate a real CDN in a future, I can do that without change any code, just removing the htaccess directive.
I guess you can also use
if($user->image!='')
if you are any images in you image field you cannot check the url, happends to me also, I always check if the object image is not null or the count as you've done.
Is there a way to change the default folder for storing images with the image field? With some hooks maybe? I need this because my images can be shared by users and the default path it's "ugly" good for production images but not for sharing images.
I'm storing my images on Amazons3 using an url field inside a template as my image path but i want to store only the big version on Amazon and let PW take care of the small thumbs.
The problem is that the image field stores the original image before creating the thumb. Is there a way to save the first image already as thumb using the size() function ? something like $page->images->add()->size() and than save?
Thanks Ryan but i solved the problem in another way, I changed my structure and removing one intermediate page between the parent I'm looking for and the piciture page, so now i can use the direct "parent="
Soma, that works, a good solution, but in my case i need to paginate the result, for this reason i used the limit, but it looks like the built in pagination to this final PageArray doesn't work...
I have this selector
$photos = $pages->find("template=picture,has_parent=2293|1038,limit=20,sort=-created");
I got this warning even i can show correctly my photos...
Warning: preg_match() expects parameter 2 to be string, array given in /public_html/wire/core/Sanitizer.php on line 266/
mm Ryan I'm trying to use your first suggest, there is some syntax error in there?
The $fav variable is a pageArray ? If i want to set a limit in there?
mmm, i was thinking the same, but what about if i have hundreds of value? Is there any problem to select by ID in large amount?
$database = $pages->fuel('db');
$userID = $user->id;
$result = $database->query("SELECT `page_id` FROM `field_favorite` WHERE `created_user_id` = $userID")->fetch_assoc();
$listID = implode($result,"|");
$fav = $pages->find("id=$listID,limit=20,sort=-created");
Hello,
I created a "favorite page" system without using the page system of PW because using a page to store these info is to heavy.
The problem now is to mix a regular query select to the API. Is that possible?
some code...
$database = $pages->fuel('db');
$userID = $user->id;
$result = $database->query("SELECT `page_id` FROM `field_favorite` WHERE `created_user_id` = $userID");
$favs = $page->find("template=product,limit=20,sort=-created");
I want to connect the page_id result of my query to the PW query to get all my favorite pages.
There a limit in how much elements can I store inside a repeater?
Right now I have a like system that store likes data (pageid and userid) in sub pages but could be nice to move this system inside a repeater field of the page template, I think to manage something like between 200-1500 records but I will never edit these records from the admin.