Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-06-07 14:09:12
- gfxx
- Member
- Registered: 2008-09-04
- Posts: 12
Max Width of images posted within hak_tinymce... What do you use?
Hello,
I tried to google for a while now solutioins to the problem that regular users aren’t familiar with image sizes. When they post an image, it might be just too big.
I tried to solve it with the CSS max-width:
.content img {
max-width:515px;
height:auto;
width: expression(this.width > 500 ? 500: true);
}
The problem is, that it of course might lead to very big images being loaded and ugly browser resizing.
For a starter, I installed the very handy plug-in ebl-image-edit
so at least the user could resize online.
Btw, it wouldn’t help to restrict the max-pix-width of all images uploaded since some need to be bigger than others.
Essentially, I would be great to control the width of images posted into the hak_tinymce editor.
I by now doubt that there is any solution to it, but anyways: I am very curious how you deal with this issue…
Thanks!
Offline
Re: Max Width of images posted within hak_tinymce... What do you use?
One thing that could be worth looking into would be making hak_tinymce support lam_dynamic_image or something similar (if anyone knows of other plugins that do something similar let me know). You could get somewhere with a rewrite-rule but otherwise it would require updating the plugin.
I’ll add it to my todo (which keeps growing)
Shoving is the answer – pusher robot
Offline
#3 2010-06-07 17:05:56
- Vide-Dressing
- Member
- Registered: 2010-06-07
- Posts: 31
Re: Max Width of images posted within hak_tinymce... What do you use?
I m used to solve this problem by adding some javascript.
http://javascript.internet.com/miscellaneous/automatic-image-resizer.html
Offline
#4 2010-06-07 17:16:38
- masa
- Member
- From: North Wales, UK
- Registered: 2005-11-25
- Posts: 1,095
Re: Max Width of images posted within hak_tinymce... What do you use?
I’m not sure about the integration with Tiny MCE, but take a look at the discussion of the Smart Image Resizer script in combination with Mary’s upm_image.
Offline
#5 2010-06-08 08:35:42
- gfxx
- Member
- Registered: 2008-09-04
- Posts: 12
Re: Max Width of images posted within hak_tinymce... What do you use?
Thanks already for your answers! I think it should someday be coded / integrated into tinymce… :)
Offline
Re: Max Width of images posted within hak_tinymce... What do you use?
Gfxx: what were you thinking? Have tinymce spit out urls that would run thing through a resizing script or something else.
Just trying to figure it out how you envision the workflow.
Shoving is the answer – pusher robot
Offline
#7 2010-06-09 06:17:45
- gfxx
- Member
- Registered: 2008-09-04
- Posts: 12
Re: Max Width of images posted within hak_tinymce... What do you use?
There are several ways of doing it… But I think the way wordpress handles things would be great for a starter. There, any time you insert an image too big (mostly talking about width) to fit the layout (should be set in the extensions tab), a smaller version of the image is inserted and linked to the original image. It sort of generates an instant thumbnail to fit the window. I think things should be as simple as possible for the end user.
Maybe, there could be an option to assign a certain class to those images generated, since you might want to have a certain formatting…
If some advanced user ever wanted to insert a very big image, there possibly could be a small checkbox in the settings in the insert-image-dialog. The latter thing, I personally wouldn’t have to use it but could anticipate this case :)
Offline
#8 2010-06-09 08:24:51
- gfxx
- Member
- Registered: 2008-09-04
- Posts: 12
Re: Max Width of images posted within hak_tinymce... What do you use?
Actually, I tried to do this myself but I do not understand the JS coding in txpimage.js of tiny_mce where I located the InsertAndClose function.
For a starter, it would be sufficient to replace the image tag inserted into the text by the lam_dynamic_image tag, if set to this option in the extension tag (“max-image-width-lam-dynamic-image:500”. (oh, btw, this would not enlarge smaller images?) The problem here might be, that formatting options might not be taken to the inserted tag. Therefore, replacing a) the url / adding to the beginning some “image.php?width=500…” b) the width/height has/should be specified by the script as well… (oh, and this image.php thingy isn’t some security issue?)
Later on, it should fully integrate into tinymce. Maybe even a third insert-image next to regular and thumbnail image. (“fit into layout image”).
Offline
Re: Max Width of images posted within hak_tinymce... What do you use?
You have to actually change it in the TXP plugin. Look for this:
$image["path"] = hu.$img_dir.'/'.$id.$ext;
Shoving is the answer – pusher robot
Offline
#10 2010-06-10 06:27:15
- gfxx
- Member
- Registered: 2008-09-04
- Posts: 12
Re: Max Width of images posted within hak_tinymce... What do you use?
Though, changing only this would result in the InsertAndClose function inserting a tag width wrong width and height values. I assume you would have to either delete the values or do the ratio-recalculation in the javascript as well: oh, width is 550, but limit was 500, so: height was 60 but image.php will process it and will result in this height… or maybe, this could be calculated in the plugin already… :)
Offline