Jump to content

mike131

Members
  • Posts

    26
  • Joined

  • Last visited

Recent Profile Visitors

1,166 profile views

mike131's Achievements

Jr. Member

Jr. Member (3/6)

3

Reputation

2

Community Answers

  1. I am currently using both the MarkupSEO module and the AmazonS3Cloudfront module. The MarkupSEO module provides an SEO tab where I can add an image url. I think that figuring out the cloudfront url of the image may be a bit too much work for the authors so I am trying to get the Cloudfront URL from AmazonS3Cloudfront module and pass it directly into the image field in MarkupSEO module. I am unable to get it to work and I am a bit lost as to where to start to try to figure this out. I have tried modifying MarkupSEO to call the function from AmazonS3Cloudfront to get the cloudfront url of the image but it is returning null. Any tips on how to go about this?
  2. Thank you @kogondo. I ended up using basically what you said with @Wanze's modification. $cnt = $pages->count("template=foo, created_users_id=$author"); Thank you!
  3. Hi, I checked the docs and the forum but I was unable to see if there was a way to get the number of posts an author has. Any ideas? Or did I miss something in the docs? Thank you!
  4. I figured out my problem, it was due to the name I was naming folders.
  5. Hi, I have a site that has other ccTLDs, such as .co.za, .co.il, etc., I am trying to make a robots.txt for each of the different domains by following this article. http://webmasters.stackexchange.com/questions/61089/serve-a-different-robots-txt-file-for-every-site-hosted-in-the-same-directory When I test however, I get a message saying 'Unable to complete this request due to an error. Error has been logged. Administrator has been notified.' with a 500 error. I don't really know much about htaccess and I am wondering if I need to put something in the processwire htaccess directives to bypass/allow what I am trying to do. The end result would be. Request is http://example.co.uk/robots.txt is redirected to /co.uk/robots.txt
  6. Thank you so much for this !!
  7. I want to change pages where you would get a simple page that says Unable to complete this request due to an error. Error has been logged. Administrator has been notified. To show a 404 page in the templates folder instead. How do I go about doing this? Thank you! EDIT: I do have a 404 page at example.com/404 So for me, there are a bunch of children items under example.com/about, such as example.com/about/resource example.com/about/team I want example.com/about to go to the 404 page since there is nothing there, only the children.
  8. Hi horst, thank you for your help again. I The function that I am using to hook after executeresize is: /* Resizes image and sends to cloud */ public function sizeBlogCloud($event) { $image = $event->object->getPageImage(); $width = (int) $this->input->get->width;//$event->arguments(0); $height = (int) $this->input->get->height; //$event->arguments(1); $options = is_array($event->arguments(2)) ? $event->arguments(2) : array(); // optional //$resizedImage = $image->size($width, $height, array('suffix' => array('is'))); if ($width < $image->width) { // add a suffix if it is a resized version, don't add a suffix if it is the original unresized image $suffix = isset($options["suffix"]) ? $options["suffix"] : array(); $suffix = is_array($suffix) ? $suffix : array($suffix); $options["suffix"] = array_merge($suffix, array("is")); } $resized = $image->size($width, $height, $options); $filename = $resized->filename; // Add to S3 $s3path = $image->page->id . "/" . $resized->name; $pathToFile = $filename; //var_dump($pathToFile); //return; $s3args = array( 'Bucket' => $this->s3_bucket, 'Key' => $s3path, 'SourceFile' => $pathToFile, 'ACL' => $this->select_acl, 'Metadata' => array( 'original_url' => $resized->url, 'info' => 'Uploaded via the AmazonS3Cloudfront PW Module' ) ); if(is_int($this->cache)) { $s3args['CacheControl'] = 'max-age=' . $this->cache; } try { $result = $this->client->putObject($s3args); } catch(Exception $e) { throw new WireException("Error: File not added to S3: {$e->getMessage()}"); } // Return the resized object return $resized; } One issue I am seeing now is that the file that gets saved to the cloud looks like: cache.example.com/files/1332/screen_shot_2014-11-18_at_12_38_09_pm.825x0-is.png while the file that the blog body looks for is: cache.example.com/files/1332/screen_shot_2014-11-18_at_12_38_09_pm.825x263-is.png From what I can tell. ProcesswireBlog module saves the <img> tags in the blog body to the database, so I am using $blog_body = str_replace('serverPathToFiles', 'cloudPathToFiles', $blog_body); So there is a difference between what is saved and the resized filename. Any ideas on why this could be? Am I calling size when it should really be a width call?
  9. So it almost works. It is uploading the resized image, however the image the blog post is looking for is not the same as what gets saved. The image that gets saved is screen_shot_2014-12-05_at_1_11_11_pm.540x0.png The image that the blog tries to use is screen_shot_2014-12-05_at_1_11_11_pm.540x0-is.png It seems to append -is to the filename. I am not sure where this is coming from and dont want to just append '-is' in the filenames, I would rather try to get this working properly.
  10. Will try it out and report back. Thank you!
  11. I don't think this is it. I think it is ProcessPageEditImageSelect.module. I see the ___executeResize function returning the response that I see from the url. I want to try to hook after this function in order to take that file and upload it to to cloud. $this->addHookAfter('ProcessPageEditImageSelect::executeResize', $this, 'sizeCloud'); When i do this, the resize call's response is now: {"error":true,"message":"Method ProcessPageEditImageSelect::size does not exist or is not callable in this context"} Any ideas on what could be the issue? EDIT: The sizeCloud function (which is located in a third party module): /* Resizes image and sends to cloud */ public function sizeCloud($event) { $image = $event->object; $width = $event->arguments(0); $height = $event->arguments(1); $options = is_array($event->arguments(2)) ? $event->arguments(2) : array(); // optional $resizedImage = $image->size($width, $height, $options); $filename = $resizedImage->filename; // Add to S3 $s3path = $image->page->id . "/" . $resizedImage->name; $pathToFile = $filename; //var_dump($pathToFile); //return; $s3args = array( 'Bucket' => $this->s3_bucket, 'Key' => $s3path, 'SourceFile' => $pathToFile, 'ACL' => $this->select_acl, 'Metadata' => array( 'original_url' => $resizedImage->url, 'info' => 'Uploaded via the AmazonS3Cloudfront PW Module' ) ); if(is_int($this->cache)) { $s3args['CacheControl'] = 'max-age=' . $this->cache; } try { $result = $this->client->putObject($s3args); } catch(Exception $e) { throw new WireException("Error: File not added to S3: {$e->getMessage()}"); } // Return the resized object return $resizedImage; }
  12. Sorry, I thought it would be more appropriate here. Will go back to the first post
  13. Hi all, I have TinyMCE that is being used for blog posts. When inserting images into the editor, it can resize images. I would like to know where that resize call happens. I believe the call to resize is going here /admin/page/image/resize?id=1331&file=1331,screen_shot_2014-12-05_at_1_11_11_pm.png&width=825&height=671 My goal is to try to hook or "hijack" the resize in order to take the resized image and upload it into the cloud. Any ideas or pointers? Thank you!
  14. Hi I am trying to figure out where TinyMCE or Processwire makes the call to resize images in a blog post. The URL i see for the resize call is /admin/page/image/resize?id=1331&file=1331,screen_shot_2014-12-05_at_1_11_11_pm.png&width=825&height=671 I would like to know where I can look to see the actual function that is called from this url. Please let me know if this is unclear. Thanks in advance!
×
×
  • Create New...