Re: Dealing with Image Uploads

2012-12-30 Thread SvenP
Hi,

I have this in one of my apps: if I remember correctly I 
used: http://github.com/josegonzalez/upload/zipball/master

It's well explained in the readme section. You can set different 
thumbnailsizes:

Code in the model:

public $actsAs = array(

'Upload.Upload' = array(

'foto'= array(

'pathMethod' = 'flat',

'path' = '{ROOT}webroot{DS}files{DS}',

'thumbnailSizes' = array(

'xvga' = '1024x768',

'vga' = '640x480',

'thumb' = '80x80'

)),

'audio1'= array(

'pathMethod' = 'flat',

'path' = '{ROOT}webroot{DS}files{DS}'

),

'audio2'= array(

'pathMethod' = 'flat',

'path' = '{ROOT}webroot{DS}files{DS}' 

),
),
); 

On Friday, December 28, 2012 6:44:38 AM UTC+1, advantage+ wrote:

 I need to figure out the best way from the backed the admin can upload 
 images, the tricky part is the site has all different kinds of images 
 (small product thumbs, large version, they want to be able to upload images 
 into the jquery slider on the home page, images for a new sections, 
 featured product on index page to name a few of the different sizes)

  

 And there is no way to know if they are even going to upload the right 
 dimensions for each type of image.

  

 What is the best way to do this? I cannot seem to think of anything having 
 a table for each_image how it relates to that page, that seems like the 
 opposite of what should be done.

  

 Any idea would be great.

  

 Thanks, Dave


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




RE: Dealing with Image Uploads

2012-12-30 Thread Advantage+
I am using Miles Johnson's Plugin for the uploads which works great now that
I have it working. 

Problem is this client wants to upload images for products which might may
many alternate images but from a user stand point it seems wrong to create
the product record, then go to Image Manager to upload photos. Same with
news section. Images for news and other places thruout the site.

 

Just need a solution and hoping to find some ideas or suggestions on how to
handle that.

 

Thanks all and happy new years to all J

 

Dave

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of SvenP
Sent: Sunday, December 30, 2012 10:37 AM
To: cake-php@googlegroups.com
Subject: Re: Dealing with Image Uploads

 

Hi,

 

I have this in one of my apps: if I remember correctly I used:
http://github.com/josegonzalez/upload/zipball/master

 

It's well explained in the readme section. You can set different
thumbnailsizes:

 

Code in the model:

 

public $actsAs = array(

'Upload.Upload' = array(

'foto'= array(

'pathMethod' = 'flat',

'path' = '{ROOT}webroot{DS}files{DS}',

'thumbnailSizes' = array(

'xvga' = '1024x768',

'vga' = '640x480',

'thumb' = '80x80'

)),

'audio1'= array(

'pathMethod' = 'flat',

'path' = '{ROOT}webroot{DS}files{DS}'

),

'audio2'= array(

'pathMethod' = 'flat',

'path' = '{ROOT}webroot{DS}files{DS}' 

),
),
); 


On Friday, December 28, 2012 6:44:38 AM UTC+1, advantage+ wrote:

I need to figure out the best way from the backed the admin can upload
images, the tricky part is the site has all different kinds of images (small
product thumbs, large version, they want to be able to upload images into
the jquery slider on the home page, images for a new sections, featured
product on index page to name a few of the different sizes)

 

And there is no way to know if they are even going to upload the right
dimensions for each type of image.

 

What is the best way to do this? I cannot seem to think of anything having a
table for each_image how it relates to that page, that seems like the
opposite of what should be done.

 

Any idea would be great.

 

Thanks, Dave

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




RE: Dealing with Image Uploads

2012-12-30 Thread Sven Pype
My solution alows me to have a form that creates the record andere directly 
attach the picture to it. Thats how it works with me.

I ad a word to the dictionary and in the same form I can select and upload a 
image for the word to illustrate it.

Not sure if this is what you're looking for.

Advantage+ movepix...@gmail.comschreef:

!-- /* Font Definitions */ @font-face {font-family:Wingdings; 
panose-1:5 0 0 0 0 0 0 0 0 0;} @font-face   {font-family:Wingdings;
 panose-1:5 0 0 0 0 0 0 0 0 0;} @font-face   {font-family:Calibri;   
panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face  {font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, 
li.MsoNormal, div.MsoNormal{margin:0in;margin-bottom:.0001pt;  
font-size:12.0pt;   font-family:Times New Roman,serif;} a:link, 
span.MsoHyperlink   {mso-style-priority:99; color:blue; 
text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99; color:purple;   text-decoration:underline;} p  
 {mso-style-priority:99; mso-margin-top-alt:auto;
margin-right:0in;   mso-margin-bottom-alt:auto; margin-left:0in;   
 font-size:12.0pt;   font-family:Times New Roman,serif;} p.p1, li.p1, 
div.p1 {mso-style-name:p1; mso-margin-top-alt:auto;
margin-right:0in;   mso-margin-bottom-alt:auto; margin-left:0in;   
 font-size:12.0pt;   font-family:Times New Roman,serif;} span.s1   
  {mso-style-name:s1;} span.s2{mso-style-name:s2;} span.s3
{mso-style-name:s3;} p.p2, li.p2, div.p2{mso-style-name:p2; 
mso-margin-top-alt:auto;margin-right:0in;   
mso-margin-bottom-alt:auto; margin-left:0in;font-size:12.0pt;  
 font-family:Times New Roman,serif;} span.s4 {mso-style-name:s4;} 
p.p3, li.p3, div.p3{mso-style-name:p3; mso-margin-top-alt:auto;
margin-right:0in;   mso-margin-bottom-alt:auto; margin-left:0in;   
 font-size:12.0pt;   font-family:Times New Roman,serif;} span.s5   
  {mso-style-name:s5;} span.apple-tab-span
{mso-style-name:apple-tab-span;} span.EmailStyle27  
{mso-style-type:personal-reply; font-family:Calibri,sans-serif;
 color:#1F497D;} .MsoChpDefault  {mso-style-type:export-only;
font-family:Calibri,sans-serif;} @page WordSection1 {size:8.5in 
11.0in; margin:1.0in 1.0in 1.0in 1.0in;} div.WordSection1   
{page:WordSection1;} --

I am using Miles Johnson's Plugin for the uploads which works great now that I 
have it working. 

Problem is this client wants to upload images for products which might may 
many alternate images but from a user stand point it seems wrong to create the 
product record, then go to Image Manager to upload photos. Same with news 
section. Images for news and other places thruout the site.

 

Just need a solution and hoping to find some ideas or suggestions on how to 
handle that.

 

Thanks all and happy new years to all J

 

Dave

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf 
Of SvenP
Sent: Sunday, December 30, 2012 10:37 AM
To: cake-php@googlegroups.com
Subject: Re: Dealing with Image Uploads

 

Hi,

 

I have this in one of my apps: if I remember correctly I used: 
http://github.com/josegonzalez/upload/zipball/master

 

It's well explained in the readme section. You can set different 
thumbnailsizes:

 

Code in the model:

 

public $actsAs = array(

        'Upload.Upload' = array(

            'foto'= array(

            'pathMethod' = 'flat',

        'path' = '{ROOT}webroot{DS}files{DS}',

            'thumbnailSizes' = array(

                    'xvga' = '1024x768',

                    'vga' = '640x480',

                    'thumb' = '80x80'

                )),

                'audio1'= array(

            'pathMethod' = 'flat',

        'path' = '{ROOT}webroot{DS}files{DS}'

                ),

                'audio2'= array(

            'pathMethod' = 'flat',

        'path' = '{ROOT}webroot{DS}files{DS}'     

                ),
            ),
    ); 


On Friday, December 28, 2012 6:44:38 AM UTC+1, advantage+ wrote:

I need to figure out the best way from the backed the admin can upload images, 
the tricky part is the site has all different kinds of images (small product 
thumbs, large version, they want to be able to upload images into the jquery 
slider on the home page, images for a new sections, featured product on index 
page to name a few of the different sizes)

 

And there is no way to know if they are even going to upload the right 
dimensions for each type of image.

 

What is the best way to do this? I cannot seem to think of anything having a 
table for each_image how it relates to that page, that seems like the opposite 
of what should be done.

 

Any idea would be great.

 

Thanks, Dave

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP

Re: Dealing with Image Uploads

2012-12-30 Thread Dave Maharaj
That is my current approach.
The image is added from the news / product add form. I suppose on the edit
page I could show all related images with option to delete or add more.
Also a js add input to add more file inputs so they can upload multiple
images as needed could be an option.

On Sun, Dec 30, 2012 at 6:50 PM, Sven Pype s...@dskbvba.be wrote:

 My solution alows me to have a form that creates the record andere
 directly attach the picture to it. Thats how it works with me.

 I ad a word to the dictionary and in the same form I can select and upload
 a image for the word to illustrate it.

 Not sure if this is what you're looking for.

 Advantage+ movepix...@gmail.comschreef:


 I am using Miles Johnson's Plugin for the uploads which works great now
 that I have it working. 

 Problem is this client wants to upload images for products which might may
 many alternate images but from a user stand point it seems wrong to create
 the product record, then go to Image Manager to upload photos. Same with
 news section. Images for news and other places thruout the site.

 ** **

 Just need a solution and hoping to find some ideas or suggestions on how
 to handle that.

 ** **

 Thanks all and happy new years to all J

 ** **

 Dave

 ** **

 *From:* cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] *On
 Behalf Of *SvenP
 *Sent:* Sunday, December 30, 2012 10:37 AM
 *To:* cake-php@googlegroups.com
 *Subject:* Re: Dealing with Image Uploads

 ** **

 Hi,

 ** **

 I have this in one of my apps: if I remember correctly I used:
 http://github.com/josegonzalez/upload/zipball/master

 ** **

 It's well explained in the readme section. You can set different
 thumbnailsizes:

 ** **

 Code in the model:

 ** **

 public $actsAs = array(

 'Upload.Upload' = array(

 'foto'= array(

 'pathMethod' = 'flat',

 'path' = '{ROOT}webroot{DS}files{DS}',

 'thumbnailSizes' = array(

 'xvga' = '1024x768',

 'vga' = '640x480',

 'thumb' = '80x80'

 )),

 'audio1'= array(

 'pathMethod' = 'flat',

 'path' = '{ROOT}webroot{DS}files{DS}'

 ),

 'audio2'= array(

 'pathMethod' = 'flat',

 'path' = '{ROOT}webroot{DS}files{DS}' 

 ),
 ),
 ); 


 On Friday, December 28, 2012 6:44:38 AM UTC+1, advantage+ wrote:

 I need to figure out the best way from the backed the admin can upload
 images, the tricky part is the site has all different kinds of images
 (small product thumbs, large version, they want to be able to upload images
 into the jquery slider on the home page, images for a new sections,
 featured product on index page to name a few of the different sizes)

  

 And there is no way to know if they are even going to upload the right
 dimensions for each type of image.

  

 What is the best way to do this? I cannot seem to think of anything having
 a table for each_image how it relates to that page, that seems like the
 opposite of what should be done.

  

 Any idea would be great.

  

 Thanks, Dave

 --
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP

 ---
 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.
 Visit this group at http://groups.google.com/group/cake-php?hl=en.

  

 --
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP

 ---
 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.
 Visit this group at http://groups.google.com/group/cake-php?hl=en.




-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




RE: Dealing with Image Uploads

2012-12-29 Thread Advantage+
Thanks, I have it working to a point.
Images get uploaded and associated correct but my model field is always
empty

Image Model:

public $belongsTo = array(
'Product' = array(
'className' = 'Product',
'foreignKey' = 'id',
'conditions' = array(
'Image.model' = 'Product'),
'dependant' = true
)
);

Product Model:
public $hasMany = array(
'Image' = array(
'className' = 'Image',
'foreignKey' = 'foreign_key',
'dependent' = true));

Do I need to add something to the Product Model relation?
Or I manually have to add in the $this-request-data['Image']['model'] =
'Product'; before the save?

Thanks again,

Dave

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of lowpass
Sent: Friday, December 28, 2012 3:17 PM
To: cake-php@googlegroups.com
Subject: Re: Dealing with Image Uploads

One approach is to add foreign_key and model columns to your images table so
you can create associations between Image and other models like this:

public $belongsTo = array(
'Publication' = array(
'className' = 'Publication',
'foreignKey' = 'foreign_key',
'conditions' = array(
'Image.model' = 'Publication'
),
'dependent' = true
),
'Author' = array(
'className' = 'Author',
'foreignKey' = 'foreign_key',
'conditions' = array(
'Image.model' = 'Author'
),
'dependent' = true
)
);

You can then store settings for the various models within the Image class:

public $settings = array(
'Publication' = array(
'directory' = 'img/publications',
'width' = 220,
'height' = 288,
'wp' = 220,
'hp' = 288,
'wl' = 220,
'hl' = 288
),
...
);

Then create an ImageComponent to handle the upload and resize, accessing the
required settings much the same way that a behavior reads its own settings
for a given model. That is,
$this-__Controller-{$model}-Image-settings[$model]['width'], or
something similar. Of course, you'll need to pass the desired model somehow,
either in the upload form or as a parameter passed from the controller to
the component.

For Thumbnails, create a separate table and associate them by image_id. The
class itself can also have a $settings array similar to that in Image, so
that you can have various sizes of thumb.

On Fri, Dec 28, 2012 at 12:44 AM, Advantage+ movepix...@gmail.com wrote:
 I need to figure out the best way from the backed the admin can upload 
 images, the tricky part is the site has all different kinds of images 
 (small product thumbs, large version, they want to be able to upload 
 images into the jquery slider on the home page, images for a new 
 sections, featured product on index page to name a few of the 
 different sizes)



 And there is no way to know if they are even going to upload the right 
 dimensions for each type of image.



 What is the best way to do this? I cannot seem to think of anything 
 having a table for each_image how it relates to that page, that seems 
 like the opposite of what should be done.



 Any idea would be great.



 Thanks, Dave

 --
 Like Us on FaceBook https://www.facebook.com/CakePHP Find us on 
 Twitter http://twitter.com/CakePHP

 ---
 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.
 Visit this group at http://groups.google.com/group/cake-php?hl=en.



--
Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter
http://twitter.com/CakePHP

---
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Dealing with Image Uploads

2012-12-28 Thread lowpass
One approach is to add foreign_key and model columns to your images
table so you can create associations between Image and other models
like this:

public $belongsTo = array(
'Publication' = array(
'className' = 'Publication',
'foreignKey' = 'foreign_key',
'conditions' = array(
'Image.model' = 'Publication'
),
'dependent' = true
),
'Author' = array(
'className' = 'Author',
'foreignKey' = 'foreign_key',
'conditions' = array(
'Image.model' = 'Author'
),
'dependent' = true
)
);

You can then store settings for the various models within the Image class:

public $settings = array(
'Publication' = array(
'directory' = 'img/publications',
'width' = 220,
'height' = 288,
'wp' = 220,
'hp' = 288,
'wl' = 220,
'hl' = 288
),
...
);

Then create an ImageComponent to handle the upload and resize,
accessing the required settings much the same way that a behavior
reads its own settings for a given model. That is,
$this-__Controller-{$model}-Image-settings[$model]['width'], or
something similar. Of course, you'll need to pass the desired model
somehow, either in the upload form or as a parameter passed from the
controller to the component.

For Thumbnails, create a separate table and associate them by
image_id. The class itself can also have a $settings array similar to
that in Image, so that you can have various sizes of thumb.

On Fri, Dec 28, 2012 at 12:44 AM, Advantage+ movepix...@gmail.com wrote:
 I need to figure out the best way from the backed the admin can upload
 images, the tricky part is the site has all different kinds of images (small
 product thumbs, large version, they want to be able to upload images into
 the jquery slider on the home page, images for a new sections, featured
 product on index page to name a few of the different sizes)



 And there is no way to know if they are even going to upload the right
 dimensions for each type of image.



 What is the best way to do this? I cannot seem to think of anything having a
 table for each_image how it relates to that page, that seems like the
 opposite of what should be done.



 Any idea would be great.



 Thanks, Dave

 --
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP

 ---
 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.
 Visit this group at http://groups.google.com/group/cake-php?hl=en.



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Dealing with Image Uploads

2012-12-27 Thread Advantage+
I need to figure out the best way from the backed the admin can upload
images, the tricky part is the site has all different kinds of images (small
product thumbs, large version, they want to be able to upload images into
the jquery slider on the home page, images for a new sections, featured
product on index page to name a few of the different sizes)

 

And there is no way to know if they are even going to upload the right
dimensions for each type of image.

 

What is the best way to do this? I cannot seem to think of anything having a
table for each_image how it relates to that page, that seems like the
opposite of what should be done.

 

Any idea would be great.

 

Thanks, Dave

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.