PHP 用 Joomla 中的 GD 库重新采样图像替换图像

发布于 2024-07-08 17:34:06 字数 355 浏览 4 评论 0原文

我是一家在线独立报纸的技术实习生,员工中的撰稿人并不精通技术。 他们不太了解网页是如何工作的,通常他们上传并包含直接来自数码相机的图像,或从原始媒体扫描的图像。 当首页上有 10 张图像(每张 3.5Mb)时,这些图像就会成为一种负担。

我们正在尝试制定某种培训方法来教他们如何调整和优化他们想要包含在文章中的图像,但就像我说的,他们不太懂技术,我们尝试采用的任何方法都可能会失败。超出他们的能力范围。

因此,我想知道尝试使用 PHP 函数和 GD 库对文章中包含的图像进行重新采样和缓存以简化每篇文章必须传递的数据量是否合理。

我认为这是可能的,我只是想弄清楚花时间和精力来培训作家是否值得,或者创建一个自动化流程是否会更好。

I am the tech intern for an online independent newspaper, and the writers on the staff are not tech-savvy. They don't quite understand how web pages work, and often they upload and include images straight from their digital cameras, or scanned from original media. These images become a burden when there are 10 images on the front page each at 3.5Mb each.

We are trying to work out some sort of training method for teaching them how to resize and optimize the images they want to include in their articles, but like I said, they are not very tech savvy, and any method we attempt to employ may go way over their heads.

So, I wanted to know if it is outside of reason to attempt to resample and cache images that are included in the articles using a PHP function and the GD library in order to stream line the amount of data that has to be passed per article.

I think it's possible, I'm just trying to figure out if it would be worth it to just take the time and effort to train the writers, or if creating an automated process would be better.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

淡墨 2024-07-15 17:34:06

你最好在上传过程中进行GD图像处理。 GD 可能会占用相当多的资源,因此在每个请求上处理每个图像并不是一个更好的解决方案。 如果您在上传过程中无法执行此操作,则应缓存所有重新采样的图像并在可用时使用这些图像。

You'd be better off doing the GD image processing during the upload process. GD can take up quite a bit of resources, so processing each image on every request would not be a preferable solution. If you can't do it during the upload process, you should cache all the resampled images and use those if/when available.

无所谓啦 2024-07-15 17:34:06

这当然是可能的,如果 Joomla! 我会感到非常惊讶。 还没有可以做到这一点的模块。

It's certainly possible, and I'd be very surprised if Joomla! doesn't already have modules that do just that.

甜扑 2024-07-15 17:34:06

对于我正在开发的当前网站,我需要回答类似的问题。 我选择使用 joomla 插件 Easy Gallery。 对我来说两个突出的功能是自动缩略图创建和图像调整大小功能。 尺寸可通过组件配置页面进行配置。 每次上传时,您都会有一个缩略图、调整大小的图像和原始图像。

该组件是 Joomla 1.0 组件,因此,如果您运行 Joomla 1.5 安装,则需要打开旧模式。 本机 1.5 版本的工作似乎正在进行中。

我还发现有几个地方没有显示生成的缩略图。 我在 Easy Gallery 论坛 上提出了问题,并设法工作为我自己找出答案。

With the current web site that I'm working on I needed to answer a similar question. I've opted for using the joomla addon Easy Gallery. The two stand out features for me are the automated thumbnail creation and the image resize feature. The sizes are configurable with the components configuration page. You'll have a thumbnail, a resized image and the original image with each upload.

This component is a Joomla 1.0 component, so, if you're running a Joomla 1.5 install you will need to turn on legacy mode. Work seems to be in progress for a native 1.5 version.

I also found a couple of places where the generated thumbnails weren't being displayed. I raised the question on the Easy Gallery forum, and managed to work out the answer for myself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文