Re: Detecting if a link is to an image
Just cooked this up for y'all, give it a try http://bin.cakephp.org/view/969827392 Seems to work ok, might be a bug or two though. hth grigri On May 21, 6:55 pm, JamesF wrote: > before you save the data you could run a regex replace function on > $this->data['Data']['texarea'] to search for urls and add the html > tags around it. > > On May 21, 12:01 am, Kyle Decot wrote: > > > I might look into those. I quickly ran into a problem because I tried > > to do $text->autoLink($autolink->images($text)); and the autoLink does > > not have a considerHtml option. Any ideas? > > > On May 20, 11:53 pm, Andrew McCafferty > > wrote: > > > > Glad it works... > > > > You might be better trying out the Textile or BBCode helpers though if > > > you need more flexibility: > > > >http://cakeforge.org/projects/textilehelper/http://bakery.cakephp.org... > > > > On 21 May, 04:15, Kyle Decot wrote: > > > > > Awesome! It's definetly a step in the right direction. I've already > > > > added it here: > > > > >http://www.theskateparkdirectory.com/forums/industry-news/clear-odyss... > > > > > I'll probably end up modifying it as there are some other things I > > > > would like it to do. Perhaps when it's done, We can post it on the > > > > bakery! Thanks! > > > > > On May 20, 11:03 pm, Andrew McCafferty > > > > wrote: > > > > > > Hi Kyle, > > > > > > I've hacked together a helper based on the TextHelper methods that > > > > > should do what you're looking for... > > > > > >http://bin.cakephp.org/view/1261676226 > > > > > > Save it to app/views/helpers/autolink.php and include it in your > > > > > helpers array: > > > > > > var $helpers = array('Html', 'Form', 'Autolink'); > > > > > > And in your view: > > > > > > images($post['Post']['content']); ?> > > > > > > Not very well tested I'm afraid but it should give you some ideas... > > > > > > On 21 May, 02:00, Kyle Decot wrote: > > > > > > > I would prefer not allowing the users to use a WYSIWYG editor. I > > > > > > would > > > > > > rather they use a simple textarea, and if they happen to include a > > > > > > URL > > > > > > in their post, then change that into a link, somewhat like $text- > > > > > > > >autoLink() but instead of creating links, create 's > > > > > > > On May 20, 8:46 pm, JamesF wrote: > > > > > > > > you might want to check out the jquery fck editor plugin. i use > > > > > > > this > > > > > > > in conjunction with jquery to turn my text area inputs into a > > > > > > > wysiwyg > > > > > > > editor and it saves html to the database. (make sure you sanitize > > > > > > > first). > > > > > > > > so if you were to go this route you first need to get jquery > > > > > > > working > > > > > > > in its most basic form on your site, than get the fck editor > > > > > > > plugin > > > > > > > for jquery, then install fck to your vendors folder. > > > > > > > > explaining in detail would be a bit lengthy but i hope it gives > > > > > > > you > > > > > > > some ideas. > > > > > > > > On May 20, 3:10 am, Kyle Decot wrote: > > > > > > > > > I am building a forum and I want to make it so that if someone > > > > > > > > enters > > > > > > > > some text w/ a link to an image in it, my script will take out > > > > > > > > the > > > > > > > > link and replace it w/ the image. Anyone know how I would do > > > > > > > > this? I > > > > > > > > would also like to do the same thing w/ youtube and vimeo links > > > > > > > > in the > > > > > > > > future. Thanks for any insight or help you can provide. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Detecting if a link is to an image
before you save the data you could run a regex replace function on $this->data['Data']['texarea'] to search for urls and add the html tags around it. On May 21, 12:01 am, Kyle Decot wrote: > I might look into those. I quickly ran into a problem because I tried > to do $text->autoLink($autolink->images($text)); and the autoLink does > not have a considerHtml option. Any ideas? > > On May 20, 11:53 pm, Andrew McCafferty > wrote: > > > Glad it works... > > > You might be better trying out the Textile or BBCode helpers though if > > you need more flexibility: > > >http://cakeforge.org/projects/textilehelper/http://bakery.cakephp.org... > > > On 21 May, 04:15, Kyle Decot wrote: > > > > Awesome! It's definetly a step in the right direction. I've already > > > added it here: > > > >http://www.theskateparkdirectory.com/forums/industry-news/clear-odyss... > > > > I'll probably end up modifying it as there are some other things I > > > would like it to do. Perhaps when it's done, We can post it on the > > > bakery! Thanks! > > > > On May 20, 11:03 pm, Andrew McCafferty > > > wrote: > > > > > Hi Kyle, > > > > > I've hacked together a helper based on the TextHelper methods that > > > > should do what you're looking for... > > > > >http://bin.cakephp.org/view/1261676226 > > > > > Save it to app/views/helpers/autolink.php and include it in your > > > > helpers array: > > > > > var $helpers = array('Html', 'Form', 'Autolink'); > > > > > And in your view: > > > > > images($post['Post']['content']); ?> > > > > > Not very well tested I'm afraid but it should give you some ideas... > > > > > On 21 May, 02:00, Kyle Decot wrote: > > > > > > I would prefer not allowing the users to use a WYSIWYG editor. I would > > > > > rather they use a simple textarea, and if they happen to include a URL > > > > > in their post, then change that into a link, somewhat like $text- > > > > > > >autoLink() but instead of creating links, create 's > > > > > > On May 20, 8:46 pm, JamesF wrote: > > > > > > > you might want to check out the jquery fck editor plugin. i use this > > > > > > in conjunction with jquery to turn my text area inputs into a > > > > > > wysiwyg > > > > > > editor and it saves html to the database. (make sure you sanitize > > > > > > first). > > > > > > > so if you were to go this route you first need to get jquery working > > > > > > in its most basic form on your site, than get the fck editor plugin > > > > > > for jquery, then install fck to your vendors folder. > > > > > > > explaining in detail would be a bit lengthy but i hope it gives you > > > > > > some ideas. > > > > > > > On May 20, 3:10 am, Kyle Decot wrote: > > > > > > > > I am building a forum and I want to make it so that if someone > > > > > > > enters > > > > > > > some text w/ a link to an image in it, my script will take out the > > > > > > > link and replace it w/ the image. Anyone know how I would do > > > > > > > this? I > > > > > > > would also like to do the same thing w/ youtube and vimeo links > > > > > > > in the > > > > > > > future. Thanks for any insight or help you can provide. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Detecting if a link is to an image
I might look into those. I quickly ran into a problem because I tried to do $text->autoLink($autolink->images($text)); and the autoLink does not have a considerHtml option. Any ideas? On May 20, 11:53 pm, Andrew McCafferty wrote: > Glad it works... > > You might be better trying out the Textile or BBCode helpers though if > you need more flexibility: > > http://cakeforge.org/projects/textilehelper/http://bakery.cakephp.org/articles/view/bbcode-helper-1 > > On 21 May, 04:15, Kyle Decot wrote: > > > > > Awesome! It's definetly a step in the right direction. I've already > > added it here: > > >http://www.theskateparkdirectory.com/forums/industry-news/clear-odyss... > > > I'll probably end up modifying it as there are some other things I > > would like it to do. Perhaps when it's done, We can post it on the > > bakery! Thanks! > > > On May 20, 11:03 pm, Andrew McCafferty > > wrote: > > > > Hi Kyle, > > > > I've hacked together a helper based on the TextHelper methods that > > > should do what you're looking for... > > > >http://bin.cakephp.org/view/1261676226 > > > > Save it to app/views/helpers/autolink.php and include it in your > > > helpers array: > > > > var $helpers = array('Html', 'Form', 'Autolink'); > > > > And in your view: > > > > images($post['Post']['content']); ?> > > > > Not very well tested I'm afraid but it should give you some ideas... > > > > On 21 May, 02:00, Kyle Decot wrote: > > > > > I would prefer not allowing the users to use a WYSIWYG editor. I would > > > > rather they use a simple textarea, and if they happen to include a URL > > > > in their post, then change that into a link, somewhat like $text- > > > > > >autoLink() but instead of creating links, create 's > > > > > On May 20, 8:46 pm, JamesF wrote: > > > > > > you might want to check out the jquery fck editor plugin. i use this > > > > > in conjunction with jquery to turn my text area inputs into a wysiwyg > > > > > editor and it saves html to the database. (make sure you sanitize > > > > > first). > > > > > > so if you were to go this route you first need to get jquery working > > > > > in its most basic form on your site, than get the fck editor plugin > > > > > for jquery, then install fck to your vendors folder. > > > > > > explaining in detail would be a bit lengthy but i hope it gives you > > > > > some ideas. > > > > > > On May 20, 3:10 am, Kyle Decot wrote: > > > > > > > I am building a forum and I want to make it so that if someone > > > > > > enters > > > > > > some text w/ a link to an image in it, my script will take out the > > > > > > link and replace it w/ the image. Anyone know how I would do this? I > > > > > > would also like to do the same thing w/ youtube and vimeo links in > > > > > > the > > > > > > future. Thanks for any insight or help you can provide. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Detecting if a link is to an image
Glad it works... You might be better trying out the Textile or BBCode helpers though if you need more flexibility: http://cakeforge.org/projects/textilehelper/ http://bakery.cakephp.org/articles/view/bbcode-helper-1 On 21 May, 04:15, Kyle Decot wrote: > Awesome! It's definetly a step in the right direction. I've already > added it here: > > http://www.theskateparkdirectory.com/forums/industry-news/clear-odyss... > > I'll probably end up modifying it as there are some other things I > would like it to do. Perhaps when it's done, We can post it on the > bakery! Thanks! > > On May 20, 11:03 pm, Andrew McCafferty > wrote: > > > Hi Kyle, > > > I've hacked together a helper based on the TextHelper methods that > > should do what you're looking for... > > >http://bin.cakephp.org/view/1261676226 > > > Save it to app/views/helpers/autolink.php and include it in your > > helpers array: > > > var $helpers = array('Html', 'Form', 'Autolink'); > > > And in your view: > > > images($post['Post']['content']); ?> > > > Not very well tested I'm afraid but it should give you some ideas... > > > On 21 May, 02:00, Kyle Decot wrote: > > > > I would prefer not allowing the users to use a WYSIWYG editor. I would > > > rather they use a simple textarea, and if they happen to include a URL > > > in their post, then change that into a link, somewhat like $text- > > > > >autoLink() but instead of creating links, create 's > > > > On May 20, 8:46 pm, JamesF wrote: > > > > > you might want to check out the jquery fck editor plugin. i use this > > > > in conjunction with jquery to turn my text area inputs into a wysiwyg > > > > editor and it saves html to the database. (make sure you sanitize > > > > first). > > > > > so if you were to go this route you first need to get jquery working > > > > in its most basic form on your site, than get the fck editor plugin > > > > for jquery, then install fck to your vendors folder. > > > > > explaining in detail would be a bit lengthy but i hope it gives you > > > > some ideas. > > > > > On May 20, 3:10 am, Kyle Decot wrote: > > > > > > I am building a forum and I want to make it so that if someone enters > > > > > some text w/ a link to an image in it, my script will take out the > > > > > link and replace it w/ the image. Anyone know how I would do this? I > > > > > would also like to do the same thing w/ youtube and vimeo links in the > > > > > future. Thanks for any insight or help you can provide. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Detecting if a link is to an image
Awesome! It's definetly a step in the right direction. I've already added it here: http://www.theskateparkdirectory.com/forums/industry-news/clear-odyssey-pegs/ I'll probably end up modifying it as there are some other things I would like it to do. Perhaps when it's done, We can post it on the bakery! Thanks! On May 20, 11:03 pm, Andrew McCafferty wrote: > Hi Kyle, > > I've hacked together a helper based on the TextHelper methods that > should do what you're looking for... > > http://bin.cakephp.org/view/1261676226 > > Save it to app/views/helpers/autolink.php and include it in your > helpers array: > > var $helpers = array('Html', 'Form', 'Autolink'); > > And in your view: > > images($post['Post']['content']); ?> > > Not very well tested I'm afraid but it should give you some ideas... > > On 21 May, 02:00, Kyle Decot wrote: > > > > > I would prefer not allowing the users to use a WYSIWYG editor. I would > > rather they use a simple textarea, and if they happen to include a URL > > in their post, then change that into a link, somewhat like $text- > > > >autoLink() but instead of creating links, create 's > > > On May 20, 8:46 pm, JamesF wrote: > > > > you might want to check out the jquery fck editor plugin. i use this > > > in conjunction with jquery to turn my text area inputs into a wysiwyg > > > editor and it saves html to the database. (make sure you sanitize > > > first). > > > > so if you were to go this route you first need to get jquery working > > > in its most basic form on your site, than get the fck editor plugin > > > for jquery, then install fck to your vendors folder. > > > > explaining in detail would be a bit lengthy but i hope it gives you > > > some ideas. > > > > On May 20, 3:10 am, Kyle Decot wrote: > > > > > I am building a forum and I want to make it so that if someone enters > > > > some text w/ a link to an image in it, my script will take out the > > > > link and replace it w/ the image. Anyone know how I would do this? I > > > > would also like to do the same thing w/ youtube and vimeo links in the > > > > future. Thanks for any insight or help you can provide. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Detecting if a link is to an image
Hi Kyle, I've hacked together a helper based on the TextHelper methods that should do what you're looking for... http://bin.cakephp.org/view/1261676226 Save it to app/views/helpers/autolink.php and include it in your helpers array: var $helpers = array('Html', 'Form', 'Autolink'); And in your view: images($post['Post']['content']); ?> Not very well tested I'm afraid but it should give you some ideas... On 21 May, 02:00, Kyle Decot wrote: > I would prefer not allowing the users to use a WYSIWYG editor. I would > rather they use a simple textarea, and if they happen to include a URL > in their post, then change that into a link, somewhat like $text- > > >autoLink() but instead of creating links, create 's > > On May 20, 8:46 pm, JamesF wrote: > > > you might want to check out the jquery fck editor plugin. i use this > > in conjunction with jquery to turn my text area inputs into a wysiwyg > > editor and it saves html to the database. (make sure you sanitize > > first). > > > so if you were to go this route you first need to get jquery working > > in its most basic form on your site, than get the fck editor plugin > > for jquery, then install fck to your vendors folder. > > > explaining in detail would be a bit lengthy but i hope it gives you > > some ideas. > > > On May 20, 3:10 am, Kyle Decot wrote: > > > > I am building a forum and I want to make it so that if someone enters > > > some text w/ a link to an image in it, my script will take out the > > > link and replace it w/ the image. Anyone know how I would do this? I > > > would also like to do the same thing w/ youtube and vimeo links in the > > > future. Thanks for any insight or help you can provide. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Detecting if a link is to an image
I would prefer not allowing the users to use a WYSIWYG editor. I would rather they use a simple textarea, and if they happen to include a URL in their post, then change that into a link, somewhat like $text- >autoLink() but instead of creating links, create 's On May 20, 8:46 pm, JamesF wrote: > you might want to check out the jquery fck editor plugin. i use this > in conjunction with jquery to turn my text area inputs into a wysiwyg > editor and it saves html to the database. (make sure you sanitize > first). > > so if you were to go this route you first need to get jquery working > in its most basic form on your site, than get the fck editor plugin > for jquery, then install fck to your vendors folder. > > explaining in detail would be a bit lengthy but i hope it gives you > some ideas. > > On May 20, 3:10 am, Kyle Decot wrote: > > > > > I am building a forum and I want to make it so that if someone enters > > some text w/ a link to an image in it, my script will take out the > > link and replace it w/ the image. Anyone know how I would do this? I > > would also like to do the same thing w/ youtube and vimeo links in the > > future. Thanks for any insight or help you can provide. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Detecting if a link is to an image
you might want to check out the jquery fck editor plugin. i use this in conjunction with jquery to turn my text area inputs into a wysiwyg editor and it saves html to the database. (make sure you sanitize first). so if you were to go this route you first need to get jquery working in its most basic form on your site, than get the fck editor plugin for jquery, then install fck to your vendors folder. explaining in detail would be a bit lengthy but i hope it gives you some ideas. On May 20, 3:10 am, Kyle Decot wrote: > I am building a forum and I want to make it so that if someone enters > some text w/ a link to an image in it, my script will take out the > link and replace it w/ the image. Anyone know how I would do this? I > would also like to do the same thing w/ youtube and vimeo links in the > future. Thanks for any insight or help you can provide. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---