0

I am doing a project using .

I want to resize an image according to user's device.

I am using this code segment to render image:

if($deal->imageBin)
    app()->controller->worklet('deal.slideshow',array('deal' => $deal, 'scaleTo'=>300));

'scaleTo' is a variable for enter width manual, but I want to use value from device screen width.

can do this using jquery?

tharanga-dinesh
  • 501
  • 6
  • 22
  • I do not know yii list of functions, so maybe something already in there, but I just would not know. One cannot, of course, acquire screen width via php, so maybe go the route of something along the lines of this: http://stackoverflow.com/a/1504526/797620 or the code further down that page http://stackoverflow.com/a/11421797/797620 and use that to pass into your yii `scaleTo` variable. – Abela Nov 21 '16 at 07:51
  • can i directly assign to php variable ? – tharanga-dinesh Nov 21 '16 at 10:04
  • one is server side the other is client side. if you wanted a pure php method, perhaps go the route of using https://github.com/serbanghita/Mobile-Detect/blob/master/Mobile_Detect.php and creating an abosolutely insane amount of `switch()` checks, each with their own xy sizes, and hope you can at least get somewhat accurate. Total hack job though. Not something I would want to do. – Abela Nov 21 '16 at 10:45

0 Answers0