Re: Display images outside webroot folder

2010-07-27 Thread rez...@gmail.com
thanx for all


I tried to use MediaView  but failed to use it in my case
my case :
each user upload his picture and I store the pic. name in database
the problem occurred when I displayed  list of all users pictures

I entered the folder into webroot/img
is there any risk doing that ?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Display images outside webroot folder

2010-07-26 Thread rez...@gmail.com
In my application I upload images in folder outside webroot called
userFiles - in the same level of webroot - and I can't display these
images using html helper
?php echo $html-image('/userFiles/my_pic.png')?
as cake consider all images url in webroot img
Any help plz

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Display images outside webroot folder

2010-07-26 Thread Andy Gale
On Mon, Jul 26, 2010 at 12:37 PM, rez...@gmail.com rez...@gmail.com wrote:
 In my application I upload images in folder outside webroot called
 userFiles - in the same level of webroot - and I can't display these
 images using html helper
 ?php echo $html-image('/userFiles/my_pic.png')?
 as cake consider all images url in webroot img
 Any help plz

They are outside the document root so your web server can't serve them.

-- 
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Display images outside webroot folder

2010-07-26 Thread rez...@gmail.com
thanx

the project files structure
/
/webroot
/userFiles
/controllers
/models
/vendors
..
..
etc

is userFiles folder outside document root ?

whats can I do to make a separated image folder for users ?

On Jul 26, 2:42 pm, Andy Gale a...@salgo.net wrote:
 On Mon, Jul 26, 2010 at 12:37 PM, rez...@gmail.com rez...@gmail.com wrote:
  In my application I upload images in folder outside webroot called
  userFiles - in the same level of webroot - and I can't display these
  images using html helper
  ?php echo $html-image('/userFiles/my_pic.png')?
  as cake consider all images url in webroot img
  Any help plz

 They are outside the document root so your web server can't serve them.

 --
 Andy Galehttp://andy-gale.comhttp://twitter.com/andygale

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Display images outside webroot folder

2010-07-26 Thread Mike Karthauser

On Mon, July 26, 2010 12:56 pm, rez...@gmail.com wrote:
 thanx

 the project files structure
 /
 /webroot
 /userFiles
 /controllers
 /models
 /vendors
 ..
 ..
 etc

 is userFiles folder outside document root ?

 whats can I do to make a separated image folder for users ?

make a folder called users inside your images folder?



 On Jul 26, 2:42 pm, Andy Gale a...@salgo.net wrote:
 On Mon, Jul 26, 2010 at 12:37 PM, rez...@gmail.com rez...@gmail.com
 wrote:
  In my application I upload images in folder outside webroot called
  userFiles - in the same level of webroot - and I can't display these
  images using html helper
  ?php echo $html-image('/userFiles/my_pic.png')?
  as cake consider all images url in webroot img
  Any help plz

 They are outside the document root so your web server can't serve them.

 --
 Andy Galehttp://andy-gale.comhttp://twitter.com/andygale

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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




-- 
Mike Karthauser
Managing Director - Brightstorm Ltd

Email: mi...@brightstorm.co.uk
Web: http://www.brightstorm.co.uk
Tel:  07939 252144 (mobile)
Fax: 0870 1320560

Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Display images outside webroot folder

2010-07-26 Thread cricket
On Mon, Jul 26, 2010 at 7:56 AM, rez...@gmail.com rez...@gmail.com wrote:
 thanx

 the project files structure
 /
 /webroot
 /userFiles
 /controllers
 /models
 /vendors
 ..
 ..
 etc

 is userFiles folder outside document root ?

Yes, the root of your site is the webroot dir (hence the name).
Anything in there can be accessed directly (like, /css/whatever.css,
/img/whatever.jpg, or /foo.html).

 whats can I do to make a separated image folder for users ?

There are three (that I know of) ways to go about this using existing
code. MediaView [1], Nick Baker's FileUpload plugin [2], or David
Persson's Media plugin [2]. I haven't used the latter, although I have
looked at the code. It seems very complete but, as I said, I haven't
used it. The FileUpload plugin works great, although I've never used
the helper part of it.  I don't know if it's a very good solution if
you'll be serving lots of these files. If so, you should consider
caching. Ditto for MediaView.

[1] http://book.cakephp.org/view/489/Media-Views
[2] http://github.com/webtechnick/CakePHP-FileUpload-Plugin
http://bakery.cakephp.org/articles/view/file-upload-component-w-automagic-model-optional
[3] http://wiki.github.com/davidpersson/media/

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Display images outside webroot folder

2010-07-26 Thread LunarDraco
When the images are uploaded do you save any information into your db
that associates to the filename on disk?

If you do you could use that model's controller and an action like
getimage and then use the media helper to return the file.

as in myapp/users/getimage/somename

This can further be enhance with named parameters to match to a
specific user
myapp/users/getimage/uid:20/fname:somename

Media View allows you to return binary data from a controller action
with a specific header that identifies its type. The controller and
model have access to the folders outside the browsers view and can
read the file and return it as a specific image.
http://book.cakephp.org/view/489/Media-Views

I use this technique to track when emails have been read. One of the
space.gif images in my emails has unique named parameter which ties it
directly to a specific sent email. So when it is read the controller
action updates the sent email as read and the gif that is returned is
a file in my templates folder.

On Jul 26, 5:15 pm, cricket zijn.digi...@gmail.com wrote:
 On Mon, Jul 26, 2010 at 7:56 AM, rez...@gmail.com rez...@gmail.com wrote:
  thanx

  the project files structure
  /
  /webroot
  /userFiles
  /controllers
  /models
  /vendors
  ..
  ..
  etc

  is userFiles folder outside document root ?

 Yes, the root of your site is the webroot dir (hence the name).
 Anything in there can be accessed directly (like, /css/whatever.css,
 /img/whatever.jpg, or /foo.html).

  whats can I do to make a separated image folder for users ?

 There are three (that I know of) ways to go about this using existing
 code. MediaView [1], Nick Baker's FileUpload plugin [2], or David
 Persson's Media plugin [2]. I haven't used the latter, although I have
 looked at the code. It seems very complete but, as I said, I haven't
 used it. The FileUpload plugin works great, although I've never used
 the helper part of it.  I don't know if it's a very good solution if
 you'll be serving lots of these files. If so, you should consider
 caching. Ditto for MediaView.

 [1]http://book.cakephp.org/view/489/Media-Views
 [2]http://github.com/webtechnick/CakePHP-FileUpload-Pluginhttp://bakery.cakephp.org/articles/view/file-upload-component-w-autom...
 [3]http://wiki.github.com/davidpersson/media/

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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