Posts

Showing posts with the label image

Image upload and display not work- Cakephp

Image upload and display not work- Cakephp I'm trying to add upload image for every connected user But I can't upload to databse Error message : Cannot convert value of type array to string Edit : When I try update The User profile from (profile function) I get message : Notice (8): Uninitialized string offset: 0 [COREsrcViewHelperUrlHelper.php, line 174] But when I update the profile From the Users (edit function) works fine UsersController.php public function edit($id = null) { $this->viewBuilder()->setLayout('user'); $user = $this->Users->get($id, [ 'contain' => ]); if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->data['password'] == '') { unset($this->request->data['password']); } $user = $this->Users->patchEntity($user, $this->request->data); if ($this->Users->save($u...

DataURL of an img with CSS class

Image
DataURL of an img with CSS class I have to apply some styles on <img> thanks to a CSS class. <img> Is it possible to get the dataURL of the <img> with the CSS style ? dataURL <img> $(function() { // Original const imgOriginal = document.getElementById('original'); const c1 = document.getElementById('c1'); let ctx = c1.getContext('2d'); ctx.drawImage(imgOriginal, 100, 100); // Filtered const imgFiltered = document.getElementById('filtered'); const c2 = document.getElementById('c2'); ctx = c2.getContext('2d'); ctx.drawImage(imgFiltered, 100, 100); // Same dataURL :( console.log(c1.toDataURL(), c2.toDataURL()); console.log(c1.toDataURL() === c2.toDataURL()); }) .filter::before { display: block; height: 100%; left: 0; position: absolute; top: 0; width: 100%; z-index: 1; border: 1px solid red; } .filter { position: relative; -webkit-filter: sepia(.5) hue-rotate(-30deg) sa...

Why is my image width and height equal to 0? [duplicate]

Why is my image width and height equal to 0? [duplicate] This question already has an answer here: I am trying to make a infinite scrolling game in javascript. The following code works as expected (it doesn't work here because the images cannot be uploaded): class Vec { constructor(x = 0, y = 0) { this.x = x; this.y = y; } } class Rect { constructor(src) { this.pos = new Vec; this.vel = new Vec; this.image = new Image(); this.image.src = src; } get left() { return this.pos.x; } get right() { return this.pos.x + this.image.width; } get top() { return this.pos.y; } get bottom() { return this.pos.y + this.image.height; } } class Player extends Rect { constructor() { super("images/frog-still.png"); this.pos.x = 100; this.pos.y = HEIGHT - GROUND_Y - this.image.height; } } class Enemy extends Rect { constructor() { super("images/spike.png"); this.image.width = this.image.width / ...

Updating a Label picture (Tk) in Python 3, has strange results

Updating a Label picture (Tk) in Python 3, has strange results Good evening, I am requesting your assistance about a strange behavior with Python 3 (Tk Library). The idea was to bind a Mouse Enter event with arguments, to a Label object containing a picture (Label Object name is : 「panel」). The method only had to update the picture. *The arguments contains four variables, we don't care about i and j yet, I just need the Image object ready to be processed, and the panel (Label) to have it's picture updated (in my example, I just use rotate method). The function does it job, however the picture becomes blank when the panel (Label) gets updated for some reason and this is what I cannot understand ! I am still a newbie with this library and Python overall, so it may be a tiny mistake, or I'm just totally wrong with the conception, I would be happy if someone had any clue! Allow me to share the portion of code concerned : 【images】is an array that have PhotoImage objects 【chunks...